diff --git a/.idea/runConfigurations/app.xml b/.idea/runConfigurations/app.xml
index aeebe8e5..fe1ee5d0 100755
--- a/.idea/runConfigurations/app.xml
+++ b/.idea/runConfigurations/app.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e4a208c0..f3398ac6 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,7 +19,7 @@
tools:ignore="UnusedAttribute">
@@ -134,11 +134,11 @@
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
+ android:parentActivityName=".activities.MainActivity">
+ android:value=".activities.MainActivity" />
{
- main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(true);
- main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.mainPosts.post(() -> {
+ mainActivity.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(true);
+ mainActivity.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
});
if (isHashtag)
- main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(mainActivity.userQuery);
else if (isLocation)
- main.mainBinding.toolbar.toolbar.setTitle(main.locationModel.getName());
- else main.mainBinding.toolbar.toolbar.setTitle("@"+main.profileModel.getUsername());
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(mainActivity.locationModel.getName());
+ else mainActivity.mainBinding.toolbar.toolbar.setTitle("@"+ mainActivity.profileModel.getUsername());
final PostModel model = result[result.length - 1];
if (model != null) {
@@ -121,38 +120,38 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
hasNextPage = model.hasNextPage();
if (autoloadPosts && hasNextPage)
currentlyExecuting = new PostsFetcher(
- main.profileModel != null ? main.profileModel.getId()
- : (main.hashtagModel != null ? main.userQuery : main.locationModel.getId()), endCursor, this)
- .setUsername((isLocation || isHashtag) ? null : main.profileModel.getUsername())
+ mainActivity.profileModel != null ? mainActivity.profileModel.getId()
+ : (mainActivity.hashtagModel != null ? mainActivity.userQuery : mainActivity.locationModel.getId()), endCursor, this)
+ .setUsername((isLocation || isHashtag) ? null : mainActivity.profileModel.getUsername())
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
}
model.setPageCursor(false, null);
}
}
else {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
- main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
- main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
+ mainActivity.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
+ mainActivity.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
}
}
};
private final FetchListener feedFetchListener = new FetchListener() {
@Override
public void doBefore() {
- main.mainBinding.feedView.feedSwipeRefreshLayout.post(() -> main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true));
+ mainActivity.mainBinding.feedView.feedSwipeRefreshLayout.post(() -> mainActivity.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true));
}
@Override
public void onResult(final FeedModel[] result) {
if (result != null) {
- final int oldSize = main.feedItems.size();
- main.feedItems.addAll(Arrays.asList(result));
+ final int oldSize = mainActivity.feedItems.size();
+ mainActivity.feedItems.addAll(Arrays.asList(result));
feedAdapter.notifyItemRangeInserted(oldSize, result.length);
- main.mainBinding.feedView.feedPosts.post(() -> main.mainBinding.feedView.feedPosts.setNestedScrollingEnabled(true));
+ mainActivity.mainBinding.feedView.feedPosts.post(() -> mainActivity.mainBinding.feedView.feedPosts.setNestedScrollingEnabled(true));
final PostModel feedPostModel = result[result.length - 1];
if (feedPostModel != null) {
@@ -162,23 +161,23 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
}
- main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(false);
}
};
private final FetchListener discoverFetchListener = new FetchListener() {
@Override
public void doBefore() {
- main.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
}
@Override
public void onResult(final DiscoverItemModel[] result) {
if (result == null || result.length == 0) {
- Toast.makeText(main, R.string.discover_empty, Toast.LENGTH_SHORT).show();
+ Toast.makeText(mainActivity, R.string.discover_empty, Toast.LENGTH_SHORT).show();
}
else if (result != null) {
- final int oldSize = main.discoverItems.size();
- main.discoverItems.addAll(Arrays.asList(result));
+ final int oldSize = mainActivity.discoverItems.size();
+ mainActivity.discoverItems.addAll(Arrays.asList(result));
discoverAdapter.notifyItemRangeInserted(oldSize, result.length);
final DiscoverItemModel discoverItemModel = result[result.length - 1];
@@ -189,7 +188,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
}
- main.mainBinding.discoverSwipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.discoverSwipeRefreshLayout.setRefreshing(false);
}
};
private final FetchListener topicFetchListener = new FetchListener() {
@@ -202,22 +201,22 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
topicIds = result.getIds();
rankToken = result.getToken();
ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(
- main, android.R.layout.simple_spinner_dropdown_item, result.getNames() );
- main.mainBinding.discoverType.setAdapter(spinnerArrayAdapter);
+ mainActivity, android.R.layout.simple_spinner_dropdown_item, result.getNames() );
+ mainActivity.mainBinding.discoverType.setAdapter(spinnerArrayAdapter);
}
}
};
private final FetchListener feedStoriesListener = new FetchListener() {
@Override
public void doBefore() {
- main.mainBinding.feedView.feedStories.setVisibility(View.GONE);
+ mainActivity.mainBinding.feedView.feedStories.setVisibility(View.GONE);
}
@Override
public void onResult(final FeedStoryModel[] result) {
feedStoriesAdapter.setData(result);
if (result != null && result.length > 0) {
- main.mainBinding.feedView.feedStories.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.feedView.feedStories.setVisibility(View.VISIBLE);
stories = result;
}
}
@@ -225,9 +224,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
private final MentionClickListener mentionClickListener = new MentionClickListener() {
@Override
public void onClick(final RamboTextView view, final String text, final boolean isHashtag) {
- new AlertDialog.Builder(main).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search)
+ new AlertDialog.Builder(mainActivity).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search)
.setTitle(text).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.ok, (dialog, which) -> {
- if (Main.scanHack != null) Main.scanHack.onResult(text);
+ if (MainActivity.scanHack != null) MainActivity.scanHack.onResult(text);
}).show();
}
};
@@ -240,19 +239,19 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
final int index = indexOfIntArray(stories, feedStoryModel);
new iStoryStatusFetcher(feedStoryModel.getStoryMediaId(), null, false, false, false, false, result -> {
if (result != null && result.length > 0)
- main.startActivity(new Intent(main, StoryViewer.class)
+ mainActivity.startActivity(new Intent(mainActivity, StoryViewer.class)
.putExtra(Constants.EXTRAS_STORIES, result)
.putExtra(Constants.EXTRAS_USERNAME, feedStoryModel.getProfileModel().getUsername())
.putExtra(Constants.FEED, stories)
.putExtra(Constants.FEED_ORDER, index)
);
- else Toast.makeText(main, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
+ else Toast.makeText(mainActivity, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
@NonNull
- private final Main main;
+ private final MainActivity mainActivity;
private Resources resources;
private final View collapsingToolbar;
private final RecyclerLazyLoader lazyLoader;
@@ -265,17 +264,17 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
private String cookie = settingsHelper.getString(Constants.COOKIE);
public boolean isLoggedIn = !Utils.isEmpty(cookie) && Utils.getUserIdFromCookie(cookie) != null;
- public MainHelper(@NonNull final Main main) {
+ public MainHelper(@NonNull final MainActivity mainActivity) {
stopCurrentExecutor();
- this.main = main;
- this.resources = main.getResources();
+ this.mainActivity = mainActivity;
+ this.resources = mainActivity.getResources();
this.autoloadPosts = settingsHelper.getBoolean(AUTOLOAD_POSTS);
- main.mainBinding.profileView.swipeRefreshLayout.setOnRefreshListener(this);
- main.mainBinding.profileView.mainUrl.setMovementMethod(new LinkMovementMethod());
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setOnRefreshListener(this);
+ mainActivity.mainBinding.profileView.mainUrl.setMovementMethod(new LinkMovementMethod());
- final LinearLayout iconSlider = main.findViewById(R.id.iconSlider);
+ final LinearLayout iconSlider = mainActivity.findViewById(R.id.iconSlider);
final ImageView iconFeed = (ImageView) iconSlider.getChildAt(0);
final ImageView iconProfile = (ImageView) iconSlider.getChildAt(1);
final ImageView iconDiscover = (ImageView) iconSlider.getChildAt(2);
@@ -283,8 +282,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
final boolean isBottomToolbar = settingsHelper.getBoolean(BOTTOM_TOOLBAR);
isLoggedIn = !Utils.isEmpty(cookie);
if (!isLoggedIn) {
- main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout);
- main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverLayout);
+ mainActivity.mainBinding.drawerLayout.removeView(mainActivity.mainBinding.feedView.feedLayout);
+ mainActivity.mainBinding.drawerLayout.removeView(mainActivity.mainBinding.discoverLayout);
iconFeed.setAlpha(0.4f);
iconDiscover.setAlpha(0.4f);
} else {
@@ -296,15 +295,15 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
setupFeed();
final TypedValue resolvedAttr = new TypedValue();
- main.getTheme().resolveAttribute(android.R.attr.textColorPrimary, resolvedAttr, true);
+ mainActivity.getTheme().resolveAttribute(android.R.attr.textColorPrimary, resolvedAttr, true);
- final int selectedItem = ContextCompat.getColor(main, resolvedAttr.resourceId != 0 ? resolvedAttr.resourceId : resolvedAttr.data);
+ final int selectedItem = ContextCompat.getColor(mainActivity, resolvedAttr.resourceId != 0 ? resolvedAttr.resourceId : resolvedAttr.data);
final ColorStateList colorStateList = ColorStateList.valueOf(selectedItem);
- main.mainBinding.toolbar.toolbar.measure(0, -1);
- final int toolbarMeasuredHeight = main.mainBinding.toolbar.toolbar.getMeasuredHeight();
+ mainActivity.mainBinding.toolbar.toolbar.measure(0, -1);
+ final int toolbarMeasuredHeight = mainActivity.mainBinding.toolbar.toolbar.getMeasuredHeight();
- final ViewGroup.LayoutParams layoutParams = main.mainBinding.toolbar.toolbar.getLayoutParams();
+ final ViewGroup.LayoutParams layoutParams = mainActivity.mainBinding.toolbar.toolbar.getLayoutParams();
final MouseDrawer.DrawerListener simpleDrawerListener = new MouseDrawer.DrawerListener() {
private final String titleDiscover = resources.getString(R.string.title_discover);
@@ -334,8 +333,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
layoutParams.height = Math.max(0, Math.min(toolbarMeasuredHeight, toolbarMeasuredHeight + roundedToolbarHeight));
- main.mainBinding.toolbar.toolbar.setLayoutParams(layoutParams);
- main.mainBinding.toolbar.toolbar.setTranslationY(toolbarHeight);
+ mainActivity.mainBinding.toolbar.toolbar.setLayoutParams(layoutParams);
+ mainActivity.mainBinding.toolbar.toolbar.setTranslationY(toolbarHeight);
imageTintList = ImageViewCompat.getImageTintList(iconDiscover);
alpha = imageTintList != null ? (imageTintList.getDefaultColor() & 0xFF_000000) >> 24 : 0;
@@ -346,8 +345,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
ImageViewCompat.setImageTintList(iconFeed, colorStateList.withAlpha(otherIconAlpha));
} else {
// this changes toolbar title
- main.mainBinding.toolbar.toolbar.setTitle(slideOffset >= 0.466 ? titleDiscover :
- (main.userQuery == null ? resources.getString(R.string.app_name) : main.userQuery));
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(slideOffset >= 0.466 ? titleDiscover :
+ (mainActivity.userQuery == null ? resources.getString(R.string.app_name) : mainActivity.userQuery));
imageTintList = ImageViewCompat.getImageTintList(iconFeed);
alpha = imageTintList != null ? (imageTintList.getDefaultColor() & 0xFF_000000) >> 24 : 0;
@@ -361,7 +360,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override
public void onDrawerOpened(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) {
- if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedView.feedLayout) {
+ if (gravity == GravityCompat.START || drawerView == mainActivity.mainBinding.feedView.feedLayout) {
if (currentFeedPlayer != null) {
final boolean shouldAutoplay = settingsHelper.getBoolean(Constants.AUTOPLAY_VIDEOS);
currentFeedPlayer.setPlayWhenReady(shouldAutoplay);
@@ -374,7 +373,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override
public void onDrawerClosed(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) {
- if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedView.feedLayout) {
+ if (gravity == GravityCompat.START || drawerView == mainActivity.mainBinding.feedView.feedLayout) {
if (currentFeedPlayer != null) {
currentFeedPlayer.setPlayWhenReady(false);
}
@@ -389,14 +388,14 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
ImageViewCompat.setImageTintList(iconProfile, colorStateList.withAlpha(255)); // to change colors when created
ImageViewCompat.setImageTintList(iconDiscover, colorStateList.withAlpha(100)); // to change colors when created
- main.mainBinding.drawerLayout.addDrawerListener(simpleDrawerListener);
+ mainActivity.mainBinding.drawerLayout.addDrawerListener(simpleDrawerListener);
}
- collapsingToolbar = main.mainBinding.profileView.appBarLayout.getChildAt(0);
+ collapsingToolbar = mainActivity.mainBinding.profileView.appBarLayout.getChildAt(0);
- main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
- main.mainBinding.profileView.highlightsList.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false));
- main.mainBinding.profileView.highlightsList.setAdapter(main.highlightsAdapter);
+ mainActivity.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
+ mainActivity.mainBinding.profileView.highlightsList.setLayoutManager(new LinearLayoutManager(mainActivity, LinearLayoutManager.HORIZONTAL, false));
+ mainActivity.mainBinding.profileView.highlightsList.setAdapter(mainActivity.highlightsAdapter);
// int color = -1;
// final Drawable background = main.mainBinding.profileView.appBarLayout.getBackground();
@@ -429,27 +428,27 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
// }
// });
- main.setSupportActionBar(main.mainBinding.toolbar.toolbar);
+ mainActivity.setSupportActionBar(mainActivity.mainBinding.toolbar.toolbar);
if (isBottomToolbar) {
- final LinearLayout linearLayout = (LinearLayout) main.mainBinding.toolbar.toolbar.getParent();
- linearLayout.removeView(main.mainBinding.toolbar.toolbar);
- linearLayout.addView(main.mainBinding.toolbar.toolbar, linearLayout.getChildCount());
+ final LinearLayout linearLayout = (LinearLayout) mainActivity.mainBinding.toolbar.toolbar.getParent();
+ linearLayout.removeView(mainActivity.mainBinding.toolbar.toolbar);
+ linearLayout.addView(mainActivity.mainBinding.toolbar.toolbar, linearLayout.getChildCount());
}
// change the next number to adjust grid
- final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(main, Utils.convertDpToPx(110));
- main.mainBinding.profileView.mainPosts.setLayoutManager(layoutManager);
- main.mainBinding.profileView.mainPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
- main.mainBinding.profileView.mainPosts.setAdapter(postsAdapter = new PostsAdapter(main.allItems, v -> {
+ final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(mainActivity, Utils.convertDpToPx(110));
+ mainActivity.mainBinding.profileView.mainPosts.setLayoutManager(layoutManager);
+ mainActivity.mainBinding.profileView.mainPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
+ mainActivity.mainBinding.profileView.mainPosts.setAdapter(postsAdapter = new PostsAdapter(mainActivity.allItems, v -> {
final Object tag = v.getTag();
if (tag instanceof PostModel) {
final PostModel postModel = (PostModel) tag;
if (postsAdapter.isSelecting) toggleSelection(postModel);
- else main.startActivity(new Intent(main, PostViewer.class)
+ else mainActivity.startActivity(new Intent(mainActivity, PostViewer.class)
.putExtra(Constants.EXTRAS_INDEX, postModel.getPosition())
.putExtra(Constants.EXTRAS_POST, postModel)
- .putExtra(Constants.EXTRAS_USER, main.userQuery)
+ .putExtra(Constants.EXTRAS_USER, mainActivity.userQuery)
.putExtra(Constants.EXTRAS_TYPE, ItemGetType.MAIN_ITEMS));
}
}, v -> { // long click listener
@@ -463,52 +462,52 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
this.lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if ((!autoloadPosts || isHashtag) && hasNextPage) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
stopCurrentExecutor();
- currentlyExecuting = new PostsFetcher(main.profileModel != null ? main.profileModel.getId()
- : (main.hashtagModel != null ? main.userQuery : main.locationModel.getId()), endCursor, postsFetchListener)
- .setUsername((isHashtag || isLocation) ? null : main.profileModel.getUsername())
+ currentlyExecuting = new PostsFetcher(mainActivity.profileModel != null ? mainActivity.profileModel.getId()
+ : (mainActivity.hashtagModel != null ? mainActivity.userQuery : mainActivity.locationModel.getId()), endCursor, postsFetchListener)
+ .setUsername((isHashtag || isLocation) ? null : mainActivity.profileModel.getUsername())
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
endCursor = null;
}
});
- main.mainBinding.profileView.mainPosts.addOnScrollListener(lazyLoader);
+ mainActivity.mainBinding.profileView.mainPosts.addOnScrollListener(lazyLoader);
}
private void setupFeed() {
- main.mainBinding.feedView.feedStories.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false));
- main.mainBinding.feedView.feedStories.setAdapter(feedStoriesAdapter);
+ mainActivity.mainBinding.feedView.feedStories.setLayoutManager(new LinearLayoutManager(mainActivity, LinearLayoutManager.HORIZONTAL, false));
+ mainActivity.mainBinding.feedView.feedStories.setAdapter(feedStoriesAdapter);
refreshFeedStories();
- final LinearLayoutManager layoutManager = new LinearLayoutManager(main);
- main.mainBinding.feedView.feedPosts.setLayoutManager(layoutManager);
- main.mainBinding.feedView.feedPosts.setAdapter(feedAdapter = new FeedAdapter(main, main.feedItems, (view, text, isHashtag) ->
- new AlertDialog.Builder(main).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search)
+ final LinearLayoutManager layoutManager = new LinearLayoutManager(mainActivity);
+ mainActivity.mainBinding.feedView.feedPosts.setLayoutManager(layoutManager);
+ mainActivity.mainBinding.feedView.feedPosts.setAdapter(feedAdapter = new FeedAdapter(mainActivity, mainActivity.feedItems, (view, text, isHashtag) ->
+ new AlertDialog.Builder(mainActivity).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search)
.setTitle(text).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.ok, (dialog, which) -> {
- if (Main.scanHack != null) {
- main.mainBinding.drawerLayout.closeDrawers();
- Main.scanHack.onResult(text);
+ if (MainActivity.scanHack != null) {
+ mainActivity.mainBinding.drawerLayout.closeDrawers();
+ MainActivity.scanHack.onResult(text);
}
}).show()));
- main.mainBinding.feedView.feedSwipeRefreshLayout.setOnRefreshListener(() -> {
+ mainActivity.mainBinding.feedView.feedSwipeRefreshLayout.setOnRefreshListener(() -> {
refreshFeedStories();
if (feedLazyLoader != null) feedLazyLoader.resetState();
- main.feedItems.clear();
+ mainActivity.feedItems.clear();
if (feedAdapter != null) feedAdapter.notifyDataSetChanged();
new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
});
- main.mainBinding.feedView.feedPosts.addOnScrollListener(feedLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
+ mainActivity.mainBinding.feedView.feedPosts.addOnScrollListener(feedLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if (feedHasNextPage) {
- main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true);
new FeedFetcher(feedEndCursor, feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
feedEndCursor = null;
}
}));
- main.mainBinding.feedView.feedPosts.addOnScrollListener(new VideoAwareRecyclerScroller(main, main.feedItems,
+ mainActivity.mainBinding.feedView.feedPosts.addOnScrollListener(new VideoAwareRecyclerScroller(mainActivity, mainActivity.feedItems,
(itemPos, player) -> currentFeedPlayer = player));
new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -527,19 +526,19 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
private void setupExplore() {
- final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(main, Utils.convertDpToPx(110));
- main.mainBinding.discoverPosts.setLayoutManager(layoutManager);
- main.mainBinding.discoverPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
+ final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(mainActivity, Utils.convertDpToPx(110));
+ mainActivity.mainBinding.discoverPosts.setLayoutManager(layoutManager);
+ mainActivity.mainBinding.discoverPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
new iTopicFetcher(topicFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- main.mainBinding.discoverType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ mainActivity.mainBinding.discoverType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
if (topicIds != null) {
topic = topicIds[pos];
- main.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
if (discoverLazyLoader != null) discoverLazyLoader.resetState();
- main.discoverItems.clear();
+ mainActivity.discoverItems.clear();
if (discoverAdapter != null) discoverAdapter.notifyDataSetChanged();
new DiscoverFetcher(topic, null, rankToken, discoverFetchListener, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -550,20 +549,20 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
});
- main.mainBinding.discoverSwipeRefreshLayout.setOnRefreshListener(() -> {
+ mainActivity.mainBinding.discoverSwipeRefreshLayout.setOnRefreshListener(() -> {
if (discoverLazyLoader != null) discoverLazyLoader.resetState();
- main.discoverItems.clear();
+ mainActivity.discoverItems.clear();
if (discoverAdapter != null) discoverAdapter.notifyDataSetChanged();
new DiscoverFetcher(topic, null, rankToken, discoverFetchListener, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
});
- main.mainBinding.discoverPosts.setAdapter(discoverAdapter = new DiscoverAdapter(main.discoverItems, v -> {
+ mainActivity.mainBinding.discoverPosts.setAdapter(discoverAdapter = new DiscoverAdapter(mainActivity.discoverItems, v -> {
final Object tag = v.getTag();
if (tag instanceof DiscoverItemModel) {
final DiscoverItemModel itemModel = (DiscoverItemModel) tag;
if (discoverAdapter.isSelecting) toggleDiscoverSelection(itemModel);
- else main.startActivity(new Intent(main, PostViewer.class)
+ else mainActivity.startActivity(new Intent(mainActivity, PostViewer.class)
.putExtra(Constants.EXTRAS_INDEX, itemModel.getPosition())
.putExtra(Constants.EXTRAS_TYPE, ItemGetType.DISCOVER_ITEMS)
.putExtra(Constants.EXTRAS_POST, new PostModel(itemModel.getShortCode(), false)));
@@ -577,9 +576,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
return true;
}));
- main.mainBinding.discoverPosts.addOnScrollListener(discoverLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
+ mainActivity.mainBinding.discoverPosts.addOnScrollListener(discoverLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if (discoverHasMore) {
- main.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.discoverSwipeRefreshLayout.setRefreshing(true);
new DiscoverFetcher(topic, discoverEndMaxId, rankToken, discoverFetchListener, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
discoverEndMaxId = null;
}
@@ -618,12 +617,12 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
final IntentModelType modelType = model.getType();
if (modelType == IntentModelType.POST) {
- main.startActivityForResult(new Intent(main, PostViewer.class)
- .putExtra(Constants.EXTRAS_USER, main.userQuery)
+ mainActivity.startActivityForResult(new Intent(mainActivity, PostViewer.class)
+ .putExtra(Constants.EXTRAS_USER, mainActivity.userQuery)
.putExtra(Constants.EXTRAS_POST, new PostModel(modelText, false)), 9629);
} else {
- main.addToStack();
- main.userQuery = modelType == IntentModelType.HASHTAG ? ('#' + modelText) :
+ mainActivity.addToStack();
+ mainActivity.userQuery = modelType == IntentModelType.HASHTAG ? ('#' + modelText) :
(modelType == IntentModelType.LOCATION ? modelText : ('@'+modelText));
onRefresh();
}
@@ -635,269 +634,269 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override
public void onRefresh() {
- main.mainBinding.drawerLayout.closeDrawers();
+ mainActivity.mainBinding.drawerLayout.closeDrawers();
if (lazyLoader != null) lazyLoader.resetState();
stopCurrentExecutor();
- main.allItems.clear();
- main.selectedItems.clear();
+ mainActivity.allItems.clear();
+ mainActivity.selectedItems.clear();
if (postsAdapter != null) {
postsAdapter.isSelecting = false;
postsAdapter.notifyDataSetChanged();
}
- main.mainBinding.profileView.appBarLayout.setExpanded(true, true);
- main.mainBinding.profileView.privatePage.setVisibility(View.GONE);
- main.mainBinding.profileView.privatePage2.setTextSize(28);
- main.mainBinding.profileView.mainProfileImage.setImageBitmap(null);
- main.mainBinding.profileView.mainHashtagImage.setImageBitmap(null);
- main.mainBinding.profileView.mainLocationImage.setImageBitmap(null);
- main.mainBinding.profileView.mainUrl.setText(null);
- main.mainBinding.profileView.locationUrl.setText(null);
- main.mainBinding.profileView.mainFullName.setText(null);
- main.mainBinding.profileView.locationFullName.setText(null);
- main.mainBinding.profileView.mainPostCount.setText(null);
- main.mainBinding.profileView.mainLocPostCount.setText(null);
- main.mainBinding.profileView.mainTagPostCount.setText(null);
- main.mainBinding.profileView.mainFollowers.setText(null);
- main.mainBinding.profileView.mainFollowing.setText(null);
- main.mainBinding.profileView.mainBiography.setText(null);
- main.mainBinding.profileView.locationBiography.setText(null);
- main.mainBinding.profileView.mainBiography.setEnabled(false);
- main.mainBinding.profileView.locationBiography.setEnabled(false);
- main.mainBinding.profileView.mainProfileImage.setEnabled(false);
- main.mainBinding.profileView.mainLocationImage.setEnabled(false);
- main.mainBinding.profileView.mainHashtagImage.setEnabled(false);
- main.mainBinding.profileView.mainBiography.setMentionClickListener(null);
- main.mainBinding.profileView.locationBiography.setMentionClickListener(null);
- main.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
- main.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
- main.mainBinding.profileView.isVerified.setVisibility(View.GONE);
- main.mainBinding.profileView.btnFollow.setVisibility(View.GONE);
- main.mainBinding.profileView.btnRestrict.setVisibility(View.GONE);
- main.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
- main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
- main.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
- main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
- main.mainBinding.profileView.btnMap.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.appBarLayout.setExpanded(true, true);
+ mainActivity.mainBinding.profileView.privatePage.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.privatePage2.setTextSize(28);
+ mainActivity.mainBinding.profileView.mainProfileImage.setImageBitmap(null);
+ mainActivity.mainBinding.profileView.mainHashtagImage.setImageBitmap(null);
+ mainActivity.mainBinding.profileView.mainLocationImage.setImageBitmap(null);
+ mainActivity.mainBinding.profileView.mainUrl.setText(null);
+ mainActivity.mainBinding.profileView.locationUrl.setText(null);
+ mainActivity.mainBinding.profileView.mainFullName.setText(null);
+ mainActivity.mainBinding.profileView.locationFullName.setText(null);
+ mainActivity.mainBinding.profileView.mainPostCount.setText(null);
+ mainActivity.mainBinding.profileView.mainLocPostCount.setText(null);
+ mainActivity.mainBinding.profileView.mainTagPostCount.setText(null);
+ mainActivity.mainBinding.profileView.mainFollowers.setText(null);
+ mainActivity.mainBinding.profileView.mainFollowing.setText(null);
+ mainActivity.mainBinding.profileView.mainBiography.setText(null);
+ mainActivity.mainBinding.profileView.locationBiography.setText(null);
+ mainActivity.mainBinding.profileView.mainBiography.setEnabled(false);
+ mainActivity.mainBinding.profileView.locationBiography.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainProfileImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainLocationImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainHashtagImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainBiography.setMentionClickListener(null);
+ mainActivity.mainBinding.profileView.locationBiography.setMentionClickListener(null);
+ mainActivity.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.isVerified.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnFollow.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnRestrict.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnMap.setVisibility(View.GONE);
- main.mainBinding.profileView.btnFollow.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnRestrict.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnBlock.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnSaved.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnLiked.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnTagged.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.btnFollowTag.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnFollow.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnRestrict.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnBlock.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnSaved.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnLiked.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnTagged.setOnClickListener(profileActionListener);
+ mainActivity.mainBinding.profileView.btnFollowTag.setOnClickListener(profileActionListener);
- main.mainBinding.profileView.infoContainer.setVisibility(View.GONE);
- main.mainBinding.profileView.tagInfoContainer.setVisibility(View.GONE);
- main.mainBinding.profileView.locInfoContainer.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.infoContainer.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.tagInfoContainer.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.locInfoContainer.setVisibility(View.GONE);
- main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
- main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
+ mainActivity.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
collapsingToolbar.setVisibility(View.GONE);
- main.highlightsAdapter.setData(null);
+ mainActivity.highlightsAdapter.setData(null);
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(main.userQuery != null);
- if (main.userQuery == null) {
- main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(mainActivity.userQuery != null);
+ if (mainActivity.userQuery == null) {
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return;
}
- isHashtag = main.userQuery.charAt(0) == '#';
- isUser = main.userQuery.charAt(0) == '@';
- isLocation = main.userQuery.contains("/");
+ isHashtag = mainActivity.userQuery.charAt(0) == '#';
+ isUser = mainActivity.userQuery.charAt(0) == '@';
+ isLocation = mainActivity.userQuery.contains("/");
collapsingToolbar.setVisibility(isUser ? View.VISIBLE : View.GONE);
if (isHashtag) {
- main.profileModel = null;
- main.locationModel = null;
- main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
- main.mainBinding.profileView.tagInfoContainer.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
+ mainActivity.profileModel = null;
+ mainActivity.locationModel = null;
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(mainActivity.userQuery);
+ mainActivity.mainBinding.profileView.tagInfoContainer.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
- currentlyExecuting = new HashtagFetcher(main.userQuery.substring(1), hashtagModel -> {
- main.hashtagModel = hashtagModel;
+ currentlyExecuting = new HashtagFetcher(mainActivity.userQuery.substring(1), hashtagModel -> {
+ mainActivity.hashtagModel = hashtagModel;
if (hashtagModel == null) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
- main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ Toast.makeText(mainActivity, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return;
}
- currentlyExecuting = new PostsFetcher(main.userQuery, postsFetchListener)
+ currentlyExecuting = new PostsFetcher(mainActivity.userQuery, postsFetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- main.mainBinding.profileView.btnFollowTag.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnFollowTag.setVisibility(View.VISIBLE);
if (isLoggedIn) {
new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, false, result -> {
- main.storyModels = result;
- if (result != null && result.length > 0) main.mainBinding.profileView.mainHashtagImage.setStoriesBorder();
+ mainActivity.storyModels = result;
+ if (result != null && result.length > 0) mainActivity.mainBinding.profileView.mainHashtagImage.setStoriesBorder();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (hashtagModel.getFollowing() == true) {
- main.mainBinding.profileView.btnFollowTag.setText(R.string.unfollow);
- main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_purple_background)));
+ mainActivity.mainBinding.profileView.btnFollowTag.setText(R.string.unfollow);
+ mainActivity.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_purple_background)));
}
else {
- main.mainBinding.profileView.btnFollowTag.setText(R.string.follow);
- main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_pink_background)));
+ mainActivity.mainBinding.profileView.btnFollowTag.setText(R.string.follow);
+ mainActivity.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_pink_background)));
}
} else {
- if (Utils.dataBox.getFavorite(main.userQuery) != null) {
- main.mainBinding.profileView.btnFollowTag.setText(R.string.unfavorite_short);
- main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_purple_background)));
+ if (Utils.dataBox.getFavorite(mainActivity.userQuery) != null) {
+ mainActivity.mainBinding.profileView.btnFollowTag.setText(R.string.unfavorite_short);
+ mainActivity.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_purple_background)));
}
else {
- main.mainBinding.profileView.btnFollowTag.setText(R.string.favorite_short);
- main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_pink_background)));
+ mainActivity.mainBinding.profileView.btnFollowTag.setText(R.string.favorite_short);
+ mainActivity.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_pink_background)));
}
}
- main.mainBinding.profileView.mainHashtagImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainHashtagImage.setEnabled(false);
new MyTask().execute();
- main.mainBinding.profileView.mainHashtagImage.setEnabled(true);
+ mainActivity.mainBinding.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);
- main.mainBinding.profileView.mainTagPostCount.setText(span);
- main.mainBinding.profileView.mainTagPostCount.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.mainTagPostCount.setText(span);
+ mainActivity.mainBinding.profileView.mainTagPostCount.setVisibility(View.VISIBLE);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else if (isUser) {
- main.hashtagModel = null;
- main.locationModel = null;
- main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
- main.mainBinding.profileView.infoContainer.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
+ mainActivity.hashtagModel = null;
+ mainActivity.locationModel = null;
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(mainActivity.userQuery);
+ mainActivity.mainBinding.profileView.infoContainer.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
- currentlyExecuting = new ProfileFetcher(main.userQuery.substring(1), profileModel -> {
- main.profileModel = profileModel;
+ currentlyExecuting = new ProfileFetcher(mainActivity.userQuery.substring(1), profileModel -> {
+ mainActivity.profileModel = profileModel;
if (profileModel == null) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
- main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ Toast.makeText(mainActivity, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return;
}
- main.mainBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
+ mainActivity.mainBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
final String profileId = profileModel.getId();
if (isLoggedIn || settingsHelper.getBoolean(Constants.STORIESIG)) {
new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false,
(!isLoggedIn && settingsHelper.getBoolean(Constants.STORIESIG)), false,
result -> {
- main.storyModels = result;
- if (result != null && result.length > 0) main.mainBinding.profileView.mainProfileImage.setStoriesBorder();
+ mainActivity.storyModels = result;
+ if (result != null && result.length > 0) mainActivity.mainBinding.profileView.mainProfileImage.setStoriesBorder();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new HighlightsFetcher(profileId, (!isLoggedIn && settingsHelper.getBoolean(Constants.STORIESIG)), result -> {
if (result != null && result.length > 0) {
- main.mainBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
- main.highlightsAdapter.setData(result);
+ mainActivity.mainBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
+ mainActivity.highlightsAdapter.setData(result);
}
- else main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
+ else mainActivity.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
if (isLoggedIn) {
final String myId = Utils.getUserIdFromCookie(cookie);
if (!profileId.equals(myId)) {
- main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
- main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
- main.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
- main.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
if (profileModel.getFollowing() == true) {
- main.mainBinding.profileView.btnFollow.setText(R.string.unfollow);
- main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_purple_background)));
+ mainActivity.mainBinding.profileView.btnFollow.setText(R.string.unfollow);
+ mainActivity.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_purple_background)));
}
else if (profileModel.getRequested() == true) {
- main.mainBinding.profileView.btnFollow.setText(R.string.cancel);
- main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_purple_background)));
+ mainActivity.mainBinding.profileView.btnFollow.setText(R.string.cancel);
+ mainActivity.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_purple_background)));
}
else {
- main.mainBinding.profileView.btnFollow.setText(R.string.follow);
- main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_pink_background)));
+ mainActivity.mainBinding.profileView.btnFollow.setText(R.string.follow);
+ mainActivity.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_pink_background)));
}
- main.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
if (profileModel.getRestricted() == true) {
- main.mainBinding.profileView.btnRestrict.setText(R.string.unrestrict);
- main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_green_background)));
+ mainActivity.mainBinding.profileView.btnRestrict.setText(R.string.unrestrict);
+ mainActivity.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_green_background)));
}
else {
- main.mainBinding.profileView.btnRestrict.setText(R.string.restrict);
- main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_orange_background)));
+ mainActivity.mainBinding.profileView.btnRestrict.setText(R.string.restrict);
+ mainActivity.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_orange_background)));
}
if (profileModel.isReallyPrivate()) {
- main.mainBinding.profileView.btnBlock.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnBlock.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
if (profileModel.getBlocked() == true) {
- main.mainBinding.profileView.btnBlock.setText(R.string.unblock);
- main.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_green_background)));
+ mainActivity.mainBinding.profileView.btnBlock.setText(R.string.unblock);
+ mainActivity.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_green_background)));
} else {
- main.mainBinding.profileView.btnBlock.setText(R.string.block);
- main.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_red_background)));
+ mainActivity.mainBinding.profileView.btnBlock.setText(R.string.block);
+ mainActivity.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_red_background)));
}
} else {
- main.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
- main.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
if (profileModel.getBlocked() == true) {
- main.mainBinding.profileView.btnSaved.setText(R.string.unblock);
- main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_green_background)));
+ mainActivity.mainBinding.profileView.btnSaved.setText(R.string.unblock);
+ mainActivity.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_green_background)));
} else {
- main.mainBinding.profileView.btnSaved.setText(R.string.block);
- main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_red_background)));
+ mainActivity.mainBinding.profileView.btnSaved.setText(R.string.block);
+ mainActivity.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_red_background)));
}
}
}
else {
- main.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnLiked.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnSaved.setText(R.string.saved);
- main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_orange_background)));
+ mainActivity.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnLiked.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnSaved.setText(R.string.saved);
+ mainActivity.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_orange_background)));
}
} else {
- if (Utils.dataBox.getFavorite(main.userQuery) != null) {
- main.mainBinding.profileView.btnFollow.setText(R.string.unfavorite_short);
- main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_purple_background)));
+ if (Utils.dataBox.getFavorite(mainActivity.userQuery) != null) {
+ mainActivity.mainBinding.profileView.btnFollow.setText(R.string.unfavorite_short);
+ mainActivity.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_purple_background)));
}
else {
- main.mainBinding.profileView.btnFollow.setText(R.string.favorite_short);
- main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_pink_background)));
+ mainActivity.mainBinding.profileView.btnFollow.setText(R.string.favorite_short);
+ mainActivity.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_pink_background)));
}
- main.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
if (!profileModel.isReallyPrivate()) {
- main.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnRestrict.setText(R.string.tagged);
- main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
- main, R.color.btn_blue_background)));
+ mainActivity.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnRestrict.setText(R.string.tagged);
+ mainActivity.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
+ mainActivity, R.color.btn_blue_background)));
}
}
- main.mainBinding.profileView.mainProfileImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainProfileImage.setEnabled(false);
new MyTask().execute();
- main.mainBinding.profileView.mainProfileImage.setEnabled(true);
+ mainActivity.mainBinding.profileView.mainProfileImage.setEnabled(true);
final long followersCount = profileModel.getFollowersCount();
final long followingCount = profileModel.getFollowingCount();
@@ -907,179 +906,179 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
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);
- main.mainBinding.profileView.mainPostCount.setText(span);
+ mainActivity.mainBinding.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);
- main.mainBinding.profileView.mainFollowers.setText(span);
+ mainActivity.mainBinding.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);
- main.mainBinding.profileView.mainFollowing.setText(span);
+ mainActivity.mainBinding.profileView.mainFollowing.setText(span);
- main.mainBinding.profileView.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername() : profileModel.getName());
+ mainActivity.mainBinding.profileView.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername() : profileModel.getName());
CharSequence biography = profileModel.getBiography();
- main.mainBinding.profileView.mainBiography.setCaptionIsExpandable(true);
- main.mainBinding.profileView.mainBiography.setCaptionIsExpanded(true);
+ mainActivity.mainBinding.profileView.mainBiography.setCaptionIsExpandable(true);
+ mainActivity.mainBinding.profileView.mainBiography.setCaptionIsExpanded(true);
if (Utils.hasMentions(biography)) {
biography = Utils.getMentionText(biography);
- main.mainBinding.profileView.mainBiography.setText(biography, TextView.BufferType.SPANNABLE);
- main.mainBinding.profileView.mainBiography.setMentionClickListener(mentionClickListener);
+ mainActivity.mainBinding.profileView.mainBiography.setText(biography, TextView.BufferType.SPANNABLE);
+ mainActivity.mainBinding.profileView.mainBiography.setMentionClickListener(mentionClickListener);
} else {
- main.mainBinding.profileView.mainBiography.setText(biography);
- main.mainBinding.profileView.mainBiography.setMentionClickListener(null);
+ mainActivity.mainBinding.profileView.mainBiography.setText(biography);
+ mainActivity.mainBinding.profileView.mainBiography.setMentionClickListener(null);
}
final String url = profileModel.getUrl();
if (Utils.isEmpty(url)) {
- main.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
} else {
- main.mainBinding.profileView.mainUrl.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.mainUrl.setText(Utils.getSpannableUrl(url));
+ mainActivity.mainBinding.profileView.mainUrl.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.mainUrl.setText(Utils.getSpannableUrl(url));
}
- main.mainBinding.profileView.mainFullName.setSelected(true);
- main.mainBinding.profileView.mainBiography.setEnabled(true);
+ mainActivity.mainBinding.profileView.mainFullName.setSelected(true);
+ mainActivity.mainBinding.profileView.mainBiography.setEnabled(true);
if (!profileModel.isReallyPrivate()) {
- main.mainBinding.profileView.mainFollowing.setClickable(true);
- main.mainBinding.profileView.mainFollowers.setClickable(true);
+ mainActivity.mainBinding.profileView.mainFollowing.setClickable(true);
+ mainActivity.mainBinding.profileView.mainFollowers.setClickable(true);
if (isLoggedIn) {
- final View.OnClickListener followClickListener = v -> main.startActivity(new Intent(main, FollowViewer.class)
- .putExtra(Constants.EXTRAS_FOLLOWERS, v == main.mainBinding.profileView.mainFollowers)
+ final View.OnClickListener followClickListener = v -> mainActivity.startActivity(new Intent(mainActivity, FollowViewer.class)
+ .putExtra(Constants.EXTRAS_FOLLOWERS, v == mainActivity.mainBinding.profileView.mainFollowers)
.putExtra(Constants.EXTRAS_NAME, profileModel.getUsername())
.putExtra(Constants.EXTRAS_ID, profileId));
- main.mainBinding.profileView.mainFollowers.setOnClickListener(followersCount > 0 ? followClickListener : null);
- main.mainBinding.profileView.mainFollowing.setOnClickListener(followingCount > 0 ? followClickListener : null);
+ mainActivity.mainBinding.profileView.mainFollowers.setOnClickListener(followersCount > 0 ? followClickListener : null);
+ mainActivity.mainBinding.profileView.mainFollowing.setOnClickListener(followingCount > 0 ? followClickListener : null);
}
if (profileModel.getPostCount() == 0) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
- main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
- main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
+ mainActivity.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
+ mainActivity.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
}
else {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
- main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
currentlyExecuting = new PostsFetcher(profileId, postsFetchListener).setUsername(profileModel.getUsername())
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
} else {
- main.mainBinding.profileView.mainFollowers.setClickable(false);
- main.mainBinding.profileView.mainFollowing.setClickable(false);
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.profileView.mainFollowers.setClickable(false);
+ mainActivity.mainBinding.profileView.mainFollowing.setClickable(false);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
// error
- main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.lock);
- main.mainBinding.profileView.privatePage2.setText(R.string.priv_acc);
- main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.mainPosts.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.privatePage1.setImageResource(R.drawable.lock);
+ mainActivity.mainBinding.profileView.privatePage2.setText(R.string.priv_acc);
+ mainActivity.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.mainPosts.setVisibility(View.GONE);
}
}
).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
else if (isLocation) {
- main.profileModel = null;
- main.hashtagModel = null;
- main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
- main.mainBinding.profileView.locInfoContainer.setVisibility(View.VISIBLE);
+ mainActivity.profileModel = null;
+ mainActivity.hashtagModel = null;
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(mainActivity.userQuery);
+ mainActivity.mainBinding.profileView.locInfoContainer.setVisibility(View.VISIBLE);
- currentlyExecuting = new LocationFetcher(main.userQuery.split("/")[0], locationModel -> {
- main.locationModel = locationModel;
+ currentlyExecuting = new LocationFetcher(mainActivity.userQuery.split("/")[0], locationModel -> {
+ mainActivity.locationModel = locationModel;
if (locationModel == null) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
- main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ Toast.makeText(mainActivity, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return;
}
- main.mainBinding.toolbar.toolbar.setTitle(locationModel.getName());
+ mainActivity.mainBinding.toolbar.toolbar.setTitle(locationModel.getName());
final String profileId = locationModel.getId();
if (isLoggedIn) {
new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, result -> {
- main.storyModels = result;
- if (result != null && result.length > 0) main.mainBinding.profileView.mainLocationImage.setStoriesBorder();
+ mainActivity.storyModels = result;
+ if (result != null && result.length > 0) mainActivity.mainBinding.profileView.mainLocationImage.setStoriesBorder();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
- main.mainBinding.profileView.mainLocationImage.setEnabled(false);
+ mainActivity.mainBinding.profileView.mainLocationImage.setEnabled(false);
new MyTask().execute();
- main.mainBinding.profileView.mainLocationImage.setEnabled(true);
+ mainActivity.mainBinding.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);
- main.mainBinding.profileView.mainLocPostCount.setText(span);
+ mainActivity.mainBinding.profileView.mainLocPostCount.setText(span);
- main.mainBinding.profileView.locationFullName.setText(locationModel.getName());
+ mainActivity.mainBinding.profileView.locationFullName.setText(locationModel.getName());
CharSequence biography = locationModel.getBio();
- main.mainBinding.profileView.locationBiography.setCaptionIsExpandable(true);
- main.mainBinding.profileView.locationBiography.setCaptionIsExpanded(true);
+ mainActivity.mainBinding.profileView.locationBiography.setCaptionIsExpandable(true);
+ mainActivity.mainBinding.profileView.locationBiography.setCaptionIsExpanded(true);
if (Utils.isEmpty(biography)) {
- main.mainBinding.profileView.locationBiography.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.locationBiography.setVisibility(View.GONE);
}
else if (Utils.hasMentions(biography)) {
- main.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
biography = Utils.getMentionText(biography);
- main.mainBinding.profileView.locationBiography.setText(biography, TextView.BufferType.SPANNABLE);
- main.mainBinding.profileView.locationBiography.setMentionClickListener(mentionClickListener);
+ mainActivity.mainBinding.profileView.locationBiography.setText(biography, TextView.BufferType.SPANNABLE);
+ mainActivity.mainBinding.profileView.locationBiography.setMentionClickListener(mentionClickListener);
} else {
- main.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.locationBiography.setText(biography);
- main.mainBinding.profileView.locationBiography.setMentionClickListener(null);
+ mainActivity.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.locationBiography.setText(biography);
+ mainActivity.mainBinding.profileView.locationBiography.setMentionClickListener(null);
}
if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) {
- main.mainBinding.profileView.btnMap.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.btnMap.setOnClickListener(v -> {
+ mainActivity.mainBinding.profileView.btnMap.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.btnMap.setOnClickListener(v -> {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(locationModel.getGeo()));
- main.startActivity(intent);
+ mainActivity.startActivity(intent);
});
}
else {
- main.mainBinding.profileView.btnMap.setVisibility(View.GONE);
- main.mainBinding.profileView.btnMap.setOnClickListener(null);
+ mainActivity.mainBinding.profileView.btnMap.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.btnMap.setOnClickListener(null);
}
final String url = locationModel.getUrl();
if (Utils.isEmpty(url)) {
- main.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
+ mainActivity.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
} else if (!url.startsWith("http")) {
- main.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl("http://"+url));
+ mainActivity.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl("http://"+url));
} else {
- main.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
- main.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl(url));
+ mainActivity.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl(url));
}
- main.mainBinding.profileView.locationFullName.setSelected(true);
- main.mainBinding.profileView.locationBiography.setEnabled(true);
+ mainActivity.mainBinding.profileView.locationFullName.setSelected(true);
+ mainActivity.mainBinding.profileView.locationBiography.setEnabled(true);
if (locationModel.getPostCount() == 0) {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
- main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
- main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
- main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
+ mainActivity.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
+ mainActivity.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
+ mainActivity.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
}
else {
- main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
- main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
+ mainActivity.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
+ mainActivity.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
currentlyExecuting = new PostsFetcher(profileId, postsFetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@@ -1101,61 +1100,61 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
private void toggleSelection(final PostModel postModel) {
- if (postModel != null && postsAdapter != null && main.selectedItems.size() >= 100) {
- Toast.makeText(main, R.string.downloader_too_many, Toast.LENGTH_SHORT);
+ if (postModel != null && postsAdapter != null && mainActivity.selectedItems.size() >= 100) {
+ Toast.makeText(mainActivity, R.string.downloader_too_many, Toast.LENGTH_SHORT);
}
else if (postModel != null && postsAdapter != null) {
- if (postModel.isSelected()) main.selectedItems.remove(postModel);
- else if (main.selectedItems.size() >= 100) {
- Toast.makeText(main, R.string.downloader_too_many, Toast.LENGTH_SHORT);
+ if (postModel.isSelected()) mainActivity.selectedItems.remove(postModel);
+ else if (mainActivity.selectedItems.size() >= 100) {
+ Toast.makeText(mainActivity, R.string.downloader_too_many, Toast.LENGTH_SHORT);
return;
}
- else main.selectedItems.add(postModel);
+ else mainActivity.selectedItems.add(postModel);
postModel.setSelected(!postModel.isSelected());
notifyAdapter(postModel);
}
}
private void notifyAdapter(final PostModel postModel) {
- if (main.selectedItems.size() < 1) postsAdapter.isSelecting = false;
+ if (mainActivity.selectedItems.size() < 1) postsAdapter.isSelecting = false;
if (postModel.getPosition() < 0) postsAdapter.notifyDataSetChanged();
else postsAdapter.notifyItemChanged(postModel.getPosition(), postModel);
- if (main.downloadAction != null) main.downloadAction.setVisible(postsAdapter.isSelecting);
+ if (mainActivity.downloadAction != null) mainActivity.downloadAction.setVisible(postsAdapter.isSelecting);
}
///////////////////////////////////////////////////
private void toggleDiscoverSelection(final DiscoverItemModel itemModel) {
if (itemModel != null && discoverAdapter != null) {
- if (itemModel.isSelected()) main.selectedDiscoverItems.remove(itemModel);
- else main.selectedDiscoverItems.add(itemModel);
+ if (itemModel.isSelected()) mainActivity.selectedDiscoverItems.remove(itemModel);
+ else mainActivity.selectedDiscoverItems.add(itemModel);
itemModel.setSelected(!itemModel.isSelected());
notifyDiscoverAdapter(itemModel);
}
}
private void notifyDiscoverAdapter(final DiscoverItemModel itemModel) {
- if (main.selectedDiscoverItems.size() < 1) discoverAdapter.isSelecting = false;
+ if (mainActivity.selectedDiscoverItems.size() < 1) discoverAdapter.isSelecting = false;
if (itemModel.getPosition() < 0) discoverAdapter.notifyDataSetChanged();
else discoverAdapter.notifyItemChanged(itemModel.getPosition(), itemModel);
- if (main.downloadAction != null) main.downloadAction.setVisible(discoverAdapter.isSelecting);
+ if (mainActivity.downloadAction != null) mainActivity.downloadAction.setVisible(discoverAdapter.isSelecting);
}
public boolean isSelectionCleared() {
if (postsAdapter != null && postsAdapter.isSelecting) {
- for (final PostModel postModel : main.selectedItems) postModel.setSelected(false);
- main.selectedItems.clear();
+ for (final PostModel postModel : mainActivity.selectedItems) postModel.setSelected(false);
+ mainActivity.selectedItems.clear();
postsAdapter.isSelecting = false;
postsAdapter.notifyDataSetChanged();
- if (main.downloadAction != null) main.downloadAction.setVisible(false);
+ if (mainActivity.downloadAction != null) mainActivity.downloadAction.setVisible(false);
return false;
} else if (discoverAdapter != null && discoverAdapter.isSelecting) {
- for (final DiscoverItemModel itemModel : main.selectedDiscoverItems) itemModel.setSelected(false);
- main.selectedDiscoverItems.clear();
+ for (final DiscoverItemModel itemModel : mainActivity.selectedDiscoverItems) itemModel.setSelected(false);
+ mainActivity.selectedDiscoverItems.clear();
discoverAdapter.isSelecting = false;
discoverAdapter.notifyDataSetChanged();
- if (main.downloadAction != null) main.downloadAction.setVisible(false);
+ if (mainActivity.downloadAction != null) mainActivity.downloadAction.setVisible(false);
return false;
}
return true;
@@ -1163,11 +1162,11 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
public void deselectSelection(final BasePostModel postModel) {
if (postModel instanceof PostModel) {
- main.selectedItems.remove(postModel);
+ mainActivity.selectedItems.remove(postModel);
postModel.setSelected(false);
if (postsAdapter != null) notifyAdapter((PostModel) postModel);
} else if (postModel instanceof DiscoverItemModel) {
- main.selectedDiscoverItems.remove(postModel);
+ mainActivity.selectedDiscoverItems.remove(postModel);
postModel.setSelected(false);
if (discoverAdapter != null) notifyDiscoverAdapter((DiscoverItemModel) postModel);
}
@@ -1203,9 +1202,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
protected Void doInBackground(Void... voids) {
try {
mIcon_val = BitmapFactory.decodeStream((InputStream) new URL(
- (main.hashtagModel != null) ? main.hashtagModel.getSdProfilePic() : (
- (main.locationModel != null) ? main.locationModel.getSdProfilePic() :
- main.profileModel.getSdProfilePic())
+ (mainActivity.hashtagModel != null) ? mainActivity.hashtagModel.getSdProfilePic() : (
+ (mainActivity.locationModel != null) ? mainActivity.locationModel.getSdProfilePic() :
+ mainActivity.profileModel.getSdProfilePic())
).getContent());
} catch (Throwable ex) {
Log.e("austin_debug", "bitmap: " + ex);
@@ -1215,47 +1214,47 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override
protected void onPostExecute(Void result) {
- if (main.hashtagModel != null) main.mainBinding.profileView.mainHashtagImage.setImageBitmap(mIcon_val);
- else if (main.locationModel != null) main.mainBinding.profileView.mainLocationImage.setImageBitmap(mIcon_val);
- else main.mainBinding.profileView.mainProfileImage.setImageBitmap(mIcon_val);
+ if (mainActivity.hashtagModel != null) mainActivity.mainBinding.profileView.mainHashtagImage.setImageBitmap(mIcon_val);
+ else if (mainActivity.locationModel != null) mainActivity.mainBinding.profileView.mainLocationImage.setImageBitmap(mIcon_val);
+ else mainActivity.mainBinding.profileView.mainProfileImage.setImageBitmap(mIcon_val);
}
}
private final View.OnClickListener profileActionListener = new View.OnClickListener() {
@Override
public void onClick(final View v) {
- final boolean iamme = (isLoggedIn && main.profileModel != null) && Utils.getUserIdFromCookie(cookie).equals(main.profileModel.getId());
- if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.profileView.btnFollow) {
- Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery,
- Long.parseLong(Utils.dataBox.getFavorite(main.userQuery).split("/")[1]),
- main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", "")));
+ final boolean iamme = (isLoggedIn && mainActivity.profileModel != null) && Utils.getUserIdFromCookie(cookie).equals(mainActivity.profileModel.getId());
+ if (!isLoggedIn && Utils.dataBox.getFavorite(mainActivity.userQuery) != null && v == mainActivity.mainBinding.profileView.btnFollow) {
+ Utils.dataBox.delFavorite(new DataBox.FavoriteModel(mainActivity.userQuery,
+ Long.parseLong(Utils.dataBox.getFavorite(mainActivity.userQuery).split("/")[1]),
+ mainActivity.locationModel != null ? mainActivity.locationModel.getName() : mainActivity.userQuery.replaceAll("^@", "")));
onRefresh();
- } else if (!isLoggedIn && (v == main.mainBinding.profileView.btnFollow || v == main.mainBinding.profileView.btnFollowTag)) {
- Utils.dataBox.addFavorite(new DataBox.FavoriteModel(main.userQuery, System.currentTimeMillis(),
- main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", "")));
+ } else if (!isLoggedIn && (v == mainActivity.mainBinding.profileView.btnFollow || v == mainActivity.mainBinding.profileView.btnFollowTag)) {
+ Utils.dataBox.addFavorite(new DataBox.FavoriteModel(mainActivity.userQuery, System.currentTimeMillis(),
+ mainActivity.locationModel != null ? mainActivity.locationModel.getName() : mainActivity.userQuery.replaceAll("^@", "")));
onRefresh();
- } else if (v == main.mainBinding.profileView.btnFollow) {
+ } else if (v == mainActivity.mainBinding.profileView.btnFollow) {
new ProfileAction().execute("follow");
- } else if (v == main.mainBinding.profileView.btnRestrict && isLoggedIn) {
+ } else if (v == mainActivity.mainBinding.profileView.btnRestrict && isLoggedIn) {
new ProfileAction().execute("restrict");
- } else if (v == main.mainBinding.profileView.btnSaved && !iamme) {
+ } else if (v == mainActivity.mainBinding.profileView.btnSaved && !iamme) {
new ProfileAction().execute("block");
- } else if (v == main.mainBinding.profileView.btnFollowTag) {
+ } else if (v == mainActivity.mainBinding.profileView.btnFollowTag) {
new ProfileAction().execute("followtag");
- } else if (v == main.mainBinding.profileView.btnTagged || (v == main.mainBinding.profileView.btnRestrict && !isLoggedIn)) {
- main.startActivity(new Intent(main, SavedViewer.class)
- .putExtra(Constants.EXTRAS_INDEX, "%"+main.profileModel.getId())
- .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())
+ } else if (v == mainActivity.mainBinding.profileView.btnTagged || (v == mainActivity.mainBinding.profileView.btnRestrict && !isLoggedIn)) {
+ mainActivity.startActivity(new Intent(mainActivity, SavedViewer.class)
+ .putExtra(Constants.EXTRAS_INDEX, "%"+ mainActivity.profileModel.getId())
+ .putExtra(Constants.EXTRAS_USER, "@"+ mainActivity.profileModel.getUsername())
);
- } else if (v == main.mainBinding.profileView.btnSaved) {
- main.startActivity(new Intent(main, SavedViewer.class)
- .putExtra(Constants.EXTRAS_INDEX, "$"+main.profileModel.getId())
- .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())
+ } else if (v == mainActivity.mainBinding.profileView.btnSaved) {
+ mainActivity.startActivity(new Intent(mainActivity, SavedViewer.class)
+ .putExtra(Constants.EXTRAS_INDEX, "$"+ mainActivity.profileModel.getId())
+ .putExtra(Constants.EXTRAS_USER, "@"+ mainActivity.profileModel.getUsername())
);
- } else if (v == main.mainBinding.profileView.btnLiked) {
- main.startActivity(new Intent(main, SavedViewer.class)
- .putExtra(Constants.EXTRAS_INDEX, "^"+main.profileModel.getId())
- .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())
+ } else if (v == mainActivity.mainBinding.profileView.btnLiked) {
+ mainActivity.startActivity(new Intent(mainActivity, SavedViewer.class)
+ .putExtra(Constants.EXTRAS_INDEX, "^"+ mainActivity.profileModel.getId())
+ .putExtra(Constants.EXTRAS_USER, "@"+ mainActivity.profileModel.getUsername())
);
}
}
@@ -1268,16 +1267,16 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
protected Void doInBackground(String... rawAction) {
action = rawAction[0];
final String url = "https://www.instagram.com/web/"+
- ((action == "followtag" && main.hashtagModel != null) ? ("tags/"+
- (main.hashtagModel.getFollowing() == true ? "unfollow/" : "follow/")+main.hashtagModel.getName()+"/") : (
- ((action == "restrict" && main.profileModel != null) ? "restrict_action" : ("friendships/"+main.profileModel.getId()))+"/"+
- ((action == "follow" && main.profileModel != null) ?
- ((main.profileModel.getFollowing() == true ||
- (main.profileModel.getFollowing() == false && main.profileModel.getRequested() == true))
+ ((action == "followtag" && mainActivity.hashtagModel != null) ? ("tags/"+
+ (mainActivity.hashtagModel.getFollowing() == true ? "unfollow/" : "follow/")+ mainActivity.hashtagModel.getName()+"/") : (
+ ((action == "restrict" && mainActivity.profileModel != null) ? "restrict_action" : ("friendships/"+ mainActivity.profileModel.getId()))+"/"+
+ ((action == "follow" && mainActivity.profileModel != null) ?
+ ((mainActivity.profileModel.getFollowing() == true ||
+ (mainActivity.profileModel.getFollowing() == false && mainActivity.profileModel.getRequested() == true))
? "unfollow/" : "follow/") :
- ((action == "restrict" && main.profileModel != null) ?
- (main.profileModel.getRestricted() == true ? "unrestrict/" : "restrict/") :
- (main.profileModel.getBlocked() == true ? "unblock/" : "block/")))));
+ ((action == "restrict" && mainActivity.profileModel != null) ?
+ (mainActivity.profileModel.getRestricted() == true ? "unrestrict/" : "restrict/") :
+ (mainActivity.profileModel.getBlocked() == true ? "unblock/" : "block/")))));
try {
final HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
urlConnection.setRequestMethod("POST");
@@ -1285,7 +1284,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
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="+main.profileModel.getId();
+ final String urlParameters = "target_user_id="+ mainActivity.profileModel.getId();
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlConnection.setRequestProperty("Content-Length", "" +
urlParameters.getBytes().length);
@@ -1299,7 +1298,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
ok = true;
}
- else Toast.makeText(main, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
+ else Toast.makeText(mainActivity, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
urlConnection.disconnect();
} catch (Throwable ex) {
Log.e("austin_debug", action+": " + ex);
diff --git a/app/src/main/java/awais/instagrabber/activities/Main.java b/app/src/main/java/awais/instagrabber/activities/MainActivity.java
old mode 100755
new mode 100644
similarity index 98%
rename from app/src/main/java/awais/instagrabber/activities/Main.java
rename to app/src/main/java/awais/instagrabber/activities/MainActivity.java
index 21d5a5bb..9fe739d2
--- a/app/src/main/java/awais/instagrabber/activities/Main.java
+++ b/app/src/main/java/awais/instagrabber/activities/MainActivity.java
@@ -69,7 +69,7 @@ import static awais.instagrabber.utils.Utils.CHANNEL_ID;
import static awais.instagrabber.utils.Utils.notificationManager;
import static awais.instagrabber.utils.Utils.settingsHelper;
-public final class Main extends BaseLanguageActivity {
+public final class MainActivity extends BaseLanguageActivity {
private static final int INITIAL_DELAY_MILLIS = 200;
public static FetchListener scanHack;
public static ItemGetter itemGetter;
@@ -90,13 +90,13 @@ public final class Main extends BaseLanguageActivity {
new iStoryStatusFetcher(highlightModel.getId(), null, false, false,
(!mainHelper.isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
if (result != null && result.length > 0)
- startActivity(new Intent(Main.this, StoryViewer.class)
+ startActivity(new Intent(MainActivity.this, StoryViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
.putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
.putExtra(Constants.EXTRAS_STORIES, result)
);
else
- Toast.makeText(Main.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
+ Toast.makeText(MainActivity.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@@ -264,7 +264,7 @@ public final class Main extends BaseLanguageActivity {
final GetActivityAsyncTask activityAsyncTask = new GetActivityAsyncTask(uid, cookie, result -> {
if (result == null) {
if (!Utils.isEmpty(cookie)) {
- Toast.makeText(Main.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
+ Toast.makeText(MainActivity.this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show();
}
return;
}
@@ -293,7 +293,7 @@ public final class Main extends BaseLanguageActivity {
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(Main.this, CHANNEL_ID)
+ final Notification notification = new NotificationCompat.Builder(MainActivity.this, CHANNEL_ID)
.setCategory(NotificationCompat.CATEGORY_STATUS)
.setSmallIcon(R.drawable.ic_notif)
.setAutoCancel(true)
diff --git a/app/src/main/java/awais/instagrabber/activities/PostViewer.java b/app/src/main/java/awais/instagrabber/activities/PostViewer.java
index 0241419a..61270011 100755
--- a/app/src/main/java/awais/instagrabber/activities/PostViewer.java
+++ b/app/src/main/java/awais/instagrabber/activities/PostViewer.java
@@ -243,8 +243,7 @@ public final class PostViewer extends BaseLanguageActivity {
}
}
- setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(),
- viewerPostModel.getLocation() == null ? null : viewerPostModel.getLocation());
+ setupPostInfoBar("@"+viewerPostModel.getUsername(), viewerPostModel.getItemType(), viewerPostModel.getLocation());
postCaption = postModel.getPostCaption();
viewerCaptionParent.setVisibility(View.VISIBLE);
@@ -323,8 +322,8 @@ public final class PostViewer extends BaseLanguageActivity {
itemGetterItems = SavedViewer.itemGetter.get(itemGetType);
isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.SAVED_ITEMS && isFromShare);
}
- else if (itemGetType != null && Main.itemGetter != null) {
- itemGetterItems = Main.itemGetter.get(itemGetType);
+ else if (itemGetType != null && MainActivity.itemGetter != null) {
+ itemGetterItems = MainActivity.itemGetter.get(itemGetType);
isMainSwipe = !(itemGetterItems.size() < 1 || itemGetType == ItemGetType.MAIN_ITEMS && isFromShare);
} else {
itemGetterItems = null;
diff --git a/app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java b/app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
index b5f11f95..248b8a31 100755
--- a/app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
+++ b/app/src/main/java/awais/instagrabber/dialogs/QuickAccessDialog.java
@@ -6,7 +6,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.util.Log;
import android.view.View;
import android.widget.Toast;
@@ -22,7 +21,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.ArrayList;
import awais.instagrabber.R;
-import awais.instagrabber.activities.Main;
+import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.adapters.SimpleAdapter;
import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.DataBox;
@@ -113,8 +112,8 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
else Utils.showImportExportDialog(v.getContext());
} else if (tag instanceof DataBox.FavoriteModel) {
- if (Main.scanHack != null) {
- Main.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
+ if (MainActivity.scanHack != null) {
+ MainActivity.scanHack.onResult(((DataBox.FavoriteModel) tag).getQuery());
dismiss();
}
diff --git a/app/src/main/java/awais/instagrabber/utils/Utils.java b/app/src/main/java/awais/instagrabber/utils/Utils.java
index 819c8a1d..22af0b1b 100755
--- a/app/src/main/java/awais/instagrabber/utils/Utils.java
+++ b/app/src/main/java/awais/instagrabber/utils/Utils.java
@@ -70,7 +70,7 @@ import javax.crypto.spec.SecretKeySpec;
import awais.instagrabber.BuildConfig;
import awais.instagrabber.R;
-import awais.instagrabber.activities.Main;
+import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.activities.ProfileViewer;
import awais.instagrabber.activities.SavedViewer;
import awais.instagrabber.asyncs.DownloadAsync;
@@ -941,7 +941,7 @@ public final class Utils {
dir = new File(dir, username);
if (dir.exists() || dir.mkdirs()) {
- final Main main = method != DownloadMethod.DOWNLOAD_FEED && context instanceof Main ? (Main) context : null;
+ final MainActivity mainActivity = method != DownloadMethod.DOWNLOAD_FEED && context instanceof MainActivity ? (MainActivity) context : null;
final ProfileViewer pv = method == DownloadMethod.DOWNLOAD_MAIN && context instanceof ProfileViewer ? (ProfileViewer) context : null;
final SavedViewer saved = method == DownloadMethod.DOWNLOAD_SAVED && context instanceof SavedViewer ? (SavedViewer) context : null;
@@ -951,7 +951,7 @@ public final class Utils {
for (int i = itemsToDownloadSize - 1; i >= 0; i--) {
final BasePostModel selectedItem = itemsToDownload.get(i);
- if (main == null && saved == null && pv == null) {
+ if (mainActivity == null && saved == null && pv == null) {
new DownloadAsync(context,
selectedItem.getDisplayUrl(),
getDownloadSaveFile(finalDir, selectedItem, ""),
@@ -973,13 +973,13 @@ public final class Utils {
file -> {
model.setDownloaded(true);
if (saved != null) saved.deselectSelection(selectedItem);
- else if (main != null) main.mainHelper.deselectSelection(selectedItem);
+ else if (mainActivity != null) mainActivity.mainHelper.deselectSelection(selectedItem);
else if (pv != null) pv.deselectSelection(selectedItem);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
} else {
if (saved != null) saved.deselectSelection(selectedItem);
- else if (main != null) main.mainHelper.deselectSelection(selectedItem);
+ else if (mainActivity != null) mainActivity.mainHelper.deselectSelection(selectedItem);
else if (pv != null) pv.deselectSelection(selectedItem);
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -1014,7 +1014,7 @@ public final class Utils {
dir = new File(dir, username);
if (dir.exists() || dir.mkdirs()) {
- final Main main = method != DownloadMethod.DOWNLOAD_FEED && context instanceof Main ? (Main) context : null;
+ final MainActivity mainActivity = method != DownloadMethod.DOWNLOAD_FEED && context instanceof MainActivity ? (MainActivity) context : null;
final int itemsToDownloadSize = itemsToDownload.size();
@@ -1022,7 +1022,7 @@ public final class Utils {
for (int i = itemsToDownloadSize - 1; i >= 0; i--) {
final DirectItemMediaModel selectedItem = itemsToDownload.get(i);
- if (main == null) {
+ if (mainActivity == null) {
new DownloadAsync(context,
selectedItem.getMediaType() == MediaItemType.MEDIA_TYPE_VIDEO ? selectedItem.getVideoUrl() : selectedItem.getThumbUrl(),
getDownloadSaveFileDm(finalDir, selectedItem, ""),
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 47dd39f0..74b7e606 100755
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".activities.Main">
+ tools:context=".activities.MainActivity">