Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to open multiple subreddits on top of each other using longpress #1128

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">
<h1 align="center">
Infinity For Reddit <a href="https://www.patreon.com/docile_alligator"><img src="https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>

</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,12 +859,16 @@ mExecutor, new Handler(), true,
}

@Override
public void onSubscribedSubredditClick(String subredditName) {
Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
startActivity(intent);
public void onSubscribedSubredditClick(String subredditName, int type) {
Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
if(type==1){
intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
}
startActivity(intent);
}


@Override
public void onAccountClick(String accountName) {
SwitchAccount.switchAccount(mRedditDataRoomDatabase, mCurrentAccountSharedPreferences,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
}

holder.itemView.setOnClickListener(view -> {
itemClickListener.onSubscribedSubredditClick(subredditName);
itemClickListener.onSubscribedSubredditClick(subredditName,0);
});
holder.itemView.setOnLongClickListener(view -> {
itemClickListener.onSubscribedSubredditClick(subredditName,1);
return true;
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public void setHideKarma(boolean hideKarma) {

public interface ItemClickListener {
void onMenuClick(int stringId);
void onSubscribedSubredditClick(String subredditName);
void onSubscribedSubredditClick(String subredditName, int type);

void onAccountClick(String accountName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
}

holder.itemView.setOnClickListener(view -> {
itemClickListener.onSubscribedSubredditClick(subredditName);
itemClickListener.onSubscribedSubredditClick(subredditName,0);
});
holder.itemView.setOnLongClickListener(view -> {
itemClickListener.onSubscribedSubredditClick(subredditName,1);
return true;
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down