aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java17
2 files changed, 20 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
index a049e9e0..dc4356f6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java
@@ -8,6 +8,7 @@ import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.util.Log;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@@ -40,6 +41,7 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String USER_PATTERN_1 = "/user/\\w+/{0,1}";
private static final String USER_PATTERN_2 = "/[uU]/\\w+/{0,1}";
private static final String SIDEBAR_PATTERN = "/[rR]/\\w+/about/sidebar";
+ private static final String MULTIREDDIT_PATTERN = "/user/\\w+/m/\\w+/{0,1}";
@Inject
SharedPreferences mSharedPreferences;
@@ -130,6 +132,8 @@ public class LinkResolverActivity extends AppCompatActivity {
}
} else if (path.matches(USER_PATTERN_1)) {
Intent intent = new Intent(this, ViewUserDetailActivity.class);
+ Log.i("afasfasfsda", "s " + path);
+ Log.i("afasfasfsda", "s " + path.substring(6));
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, path.substring(6));
intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
@@ -144,6 +148,10 @@ public class LinkResolverActivity extends AppCompatActivity {
Intent intent = new Intent(this, ViewSidebarActivity.class);
intent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, path.substring(3, path.length() - 14));
startActivity(intent);
+ } else if (path.matches(MULTIREDDIT_PATTERN)) {
+ Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class);
+ intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_PATH, path);
+ startActivity(intent);
} else {
deepLinkError(uri);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
index 220984c9..f002bb08 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
@@ -49,6 +49,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback {
public static final String EXTRA_MULTIREDDIT_DATA = "EMD";
+ public static final String EXTRA_MULTIREDDIT_PATH = "EMP";
private static final String FRAGMENT_OUT_STATE_KEY = "FOSK";
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
@@ -136,13 +137,19 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
MultiReddit multiReddit = getIntent().getParcelableExtra(EXTRA_MULTIREDDIT_DATA);
if (multiReddit == null) {
- Toast.makeText(this, R.string.multi_reddit_listing_activity_label, Toast.LENGTH_SHORT).show();
- finish();
- return;
+ multiPath = getIntent().getStringExtra(EXTRA_MULTIREDDIT_PATH);
+ if (multiPath != null) {
+ toolbar.setTitle(multiPath.substring(multiPath.lastIndexOf("/", multiPath.length() - 2) + 1));
+ } else {
+ Toast.makeText(this, R.string.error_getting_multi_reddit_data, Toast.LENGTH_SHORT).show();
+ finish();
+ return;
+ }
+ } else {
+ multiPath = multiReddit.getPath();
+ toolbar.setTitle(multiReddit.getDisplayName());
}
- multiPath = multiReddit.getPath();
- toolbar.setTitle(multiReddit.getDisplayName());
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);