mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
Merge branch 'master' of github.com:Docile-Alligator/Infinity-For-Reddit
This commit is contained in:
commit
643d9395a4
@ -272,70 +272,100 @@
|
|||||||
|
|
||||||
<data
|
<data
|
||||||
android:host="www.reddit.com"
|
android:host="www.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*"/>
|
||||||
<data
|
<data
|
||||||
android:host="reddit.com"
|
android:host="reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
|
<data
|
||||||
|
android:host="www.google.com"
|
||||||
|
android:scheme="https"
|
||||||
|
android:pathPattern="/amp/s/amp.reddit.com/.*" />
|
||||||
|
<data
|
||||||
|
android:host="v.redd.it"
|
||||||
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="amp.reddit.com"
|
android:host="amp.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="m.reddit.com"
|
android:host="m.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="old.reddit.com"
|
android:host="old.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="new.reddit.com"
|
android:host="new.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="np.reddit.com"
|
android:host="np.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="reddit.app.link"
|
android:host="reddit.app.link"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="redd.it"
|
android:host="redd.it"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="s.reddit.com"
|
android:host="s.reddit.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="click.redditmail.com"
|
android:host="click.redditmail.com"
|
||||||
android:scheme="https" />
|
android:scheme="https"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="www.reddit.com"
|
android:host="www.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="reddit.com"
|
android:host="reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="amp.reddit.com"
|
android:host="amp.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="m.reddit.com"
|
android:host="m.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="old.reddit.com"
|
android:host="old.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="new.reddit.com"
|
android:host="new.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="np.reddit.com"
|
android:host="np.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="reddit.app.link"
|
android:host="reddit.app.link"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="redd.it"
|
android:host="redd.it"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="s.reddit.com"
|
android:host="s.reddit.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
<data
|
<data
|
||||||
android:host="click.redditmail.com"
|
android:host="click.redditmail.com"
|
||||||
android:scheme="http" />
|
android:scheme="http"
|
||||||
|
android:pathPattern=".*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
@ -49,7 +49,8 @@ public class LinkResolverActivity extends AppCompatActivity {
|
|||||||
private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?";
|
private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?";
|
||||||
private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?";
|
private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?";
|
||||||
private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?";
|
private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?";
|
||||||
private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)/?\\w+";
|
private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)?(?:/\\w+)+";
|
||||||
|
private static final String GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("default")
|
@Named("default")
|
||||||
@ -173,8 +174,10 @@ public class LinkResolverActivity extends AppCompatActivity {
|
|||||||
deepLinkError(uri);
|
deepLinkError(uri);
|
||||||
}
|
}
|
||||||
} else if (path.matches(WIKI_PATTERN)) {
|
} else if (path.matches(WIKI_PATTERN)) {
|
||||||
|
final String wikiPage = path.substring(path.lastIndexOf("/wiki/") + 6);
|
||||||
Intent intent = new Intent(this, WikiActivity.class);
|
Intent intent = new Intent(this, WikiActivity.class);
|
||||||
intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1));
|
intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1));
|
||||||
|
intent.putExtra(WikiActivity.EXTRA_WIKI_PATH, wikiPage);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (path.matches(SUBREDDIT_PATTERN)) {
|
} else if (path.matches(SUBREDDIT_PATTERN)) {
|
||||||
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
|
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
|
||||||
@ -266,6 +269,13 @@ public class LinkResolverActivity extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
deepLinkError(uri);
|
deepLinkError(uri);
|
||||||
}
|
}
|
||||||
|
} else if (authority.contains("google.com") ){
|
||||||
|
if ( path.matches(GOOGLE_AMP_PATTERN) ) {
|
||||||
|
String url = path.substring(11, path.length()); // skipping past amp straight to reddit
|
||||||
|
handleUri(Uri.parse("https://" + url));
|
||||||
|
} else {
|
||||||
|
deepLinkError(uri);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
deepLinkError(uri);
|
deepLinkError(uri);
|
||||||
}
|
}
|
||||||
|
@ -523,6 +523,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.goBackToTop();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
@ -569,6 +575,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
return R.drawable.ic_outline_bookmarks_24dp;
|
return R.drawable.ic_outline_bookmarks_24dp;
|
||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED:
|
||||||
return R.drawable.ic_star_border_24dp;
|
return R.drawable.ic_star_border_24dp;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
|
||||||
|
return R.drawable.ic_keyboard_double_arrow_up_24;
|
||||||
default:
|
default:
|
||||||
return R.drawable.ic_account_circle_24dp;
|
return R.drawable.ic_account_circle_24dp;
|
||||||
}
|
}
|
||||||
|
@ -698,6 +698,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.goBackToTop();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
@ -745,6 +751,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
return R.drawable.ic_outline_bookmarks_24dp;
|
return R.drawable.ic_outline_bookmarks_24dp;
|
||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED:
|
||||||
return R.drawable.ic_star_border_24dp;
|
return R.drawable.ic_star_border_24dp;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
|
||||||
|
return R.drawable.ic_keyboard_double_arrow_up_24;
|
||||||
default:
|
default:
|
||||||
return R.drawable.ic_account_circle_24dp;
|
return R.drawable.ic_account_circle_24dp;
|
||||||
}
|
}
|
||||||
@ -1180,6 +1188,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.id.action_go_to_wiki_activity ) {
|
||||||
|
Intent wikiIntent = new Intent(this, WikiActivity.class);
|
||||||
|
wikiIntent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
|
wikiIntent.putExtra(WikiActivity.EXTRA_WIKI_PATH, "index");
|
||||||
|
startActivity(wikiIntent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ import retrofit2.Retrofit;
|
|||||||
public class WikiActivity extends BaseActivity {
|
public class WikiActivity extends BaseActivity {
|
||||||
|
|
||||||
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||||
|
public static final String EXTRA_WIKI_PATH = "EWP";
|
||||||
private static final String WIKI_MARKDOWN_STATE = "WMS";
|
private static final String WIKI_MARKDOWN_STATE = "WMS";
|
||||||
|
|
||||||
@BindView(R.id.coordinator_layout_comment_wiki_activity)
|
@BindView(R.id.coordinator_layout_comment_wiki_activity)
|
||||||
@ -281,7 +282,7 @@ public class WikiActivity extends BaseActivity {
|
|||||||
Glide.with(this).clear(mFetchWikiInfoImageView);
|
Glide.with(this).clear(mFetchWikiInfoImageView);
|
||||||
mFetchWikiInfoLinearLayout.setVisibility(View.GONE);
|
mFetchWikiInfoLinearLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
retrofit.create(RedditAPI.class).getWiki(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME)).enqueue(new Callback<String>() {
|
retrofit.create(RedditAPI.class).getWikiPage(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME), getIntent().getStringExtra(EXTRA_WIKI_PATH)).enqueue(new Callback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
|
@ -294,8 +294,12 @@ public interface RedditAPI {
|
|||||||
@GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1")
|
@GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1")
|
||||||
Call<String> getTrendingSearches(@HeaderMap Map<String, String> headers);
|
Call<String> getTrendingSearches(@HeaderMap Map<String, String> headers);
|
||||||
|
|
||||||
@GET("/r/{subredditName}/wiki/index.json?raw_json=1")
|
default Call<String> getWiki(@Path("subredditName") String subredditName) {
|
||||||
Call<String> getWiki(@Path("subredditName") String subredditName);
|
return getWikiPage(subredditName, "index");
|
||||||
|
};
|
||||||
|
|
||||||
|
@GET("/r/{subredditName}/wiki/{wikiPage}.json?raw_json=1")
|
||||||
|
Call<String> getWikiPage(@Path("subredditName") String subredditName, @Path("wikiPage") String wikiPage);
|
||||||
|
|
||||||
@GET("{sortType}?raw_json=1")
|
@GET("{sortType}?raw_json=1")
|
||||||
ListenableFuture<Response<String>> getBestPostsListenableFuture(@Path("sortType") String sortType, @Query("after") String lastItem, @HeaderMap Map<String, String> headers);
|
ListenableFuture<Response<String>> getBestPostsListenableFuture(@Path("sortType") String sortType, @Query("after") String lastItem, @HeaderMap Map<String, String> headers);
|
||||||
|
@ -249,6 +249,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN = 16;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN = 16;
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED = 17;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED = 17;
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED = 18;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED = 18;
|
||||||
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP = 19;
|
||||||
|
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH = 1;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH = 1;
|
||||||
@ -281,6 +282,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN = 17;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN = 17;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED = 18;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED = 18;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED = 19;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED = 19;
|
||||||
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP = 20;
|
||||||
|
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH = 1;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH = 1;
|
||||||
|
13
app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml
Normal file
13
app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M6,17.59l1.41,1.41l4.59,-4.58l4.59,4.58l1.41,-1.41l-6,-6z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/black"
|
||||||
|
android:pathData="M6,11l1.41,1.41l4.59,-4.58l4.59,4.58l1.41,-1.41l-6,-6z"/>
|
||||||
|
</vector>
|
@ -58,4 +58,10 @@
|
|||||||
android:orderInCategory="9"
|
android:orderInCategory="9"
|
||||||
android:title="@string/action_share"
|
android:title="@string/action_share"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_go_to_wiki_activity"
|
||||||
|
android:orderInCategory="10"
|
||||||
|
android:title="@string/action_go_to_wiki"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -283,6 +283,7 @@
|
|||||||
<item>@string/hidden</item>
|
<item>@string/hidden</item>
|
||||||
<item>@string/saved</item>
|
<item>@string/saved</item>
|
||||||
<item>@string/gilded</item>
|
<item>@string/gilded</item>
|
||||||
|
<item>@string/go_to_top</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="settings_other_activities_bottom_app_bar_options">
|
<string-array name="settings_other_activities_bottom_app_bar_options">
|
||||||
@ -306,6 +307,7 @@
|
|||||||
<item>@string/hidden</item>
|
<item>@string/hidden</item>
|
||||||
<item>@string/saved</item>
|
<item>@string/saved</item>
|
||||||
<item>@string/gilded</item>
|
<item>@string/gilded</item>
|
||||||
|
<item>@string/go_to_top</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="settings_bottom_app_bar_fab_options">
|
<string-array name="settings_bottom_app_bar_fab_options">
|
||||||
|
@ -1191,4 +1191,7 @@
|
|||||||
<string name="app_lock_timeout_12_hours">12 hours</string>
|
<string name="app_lock_timeout_12_hours">12 hours</string>
|
||||||
<string name="app_lock_timeout_24_hours">24 hours</string>
|
<string name="app_lock_timeout_24_hours">24 hours</string>
|
||||||
|
|
||||||
|
<string name="go_to_top">Go To Top</string>
|
||||||
|
<string name="action_go_to_wiki">Go to Wiki</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user