Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Many bug fixes and improvements in preparation for v5.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
SlideCI committed Oct 11, 2017
1 parent b46854c commit a218426
Show file tree
Hide file tree
Showing 56 changed files with 472 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class BaseActivity extends PeekViewActivity
protected boolean overrideRedditSwipeAnywhere = false;
protected boolean enableSwipeBackLayout = true;
protected boolean overrideSwipeFromAnywhere = false;
protected boolean verticalExit = false;
NfcAdapter mNfcAdapter;

/**
Expand Down Expand Up @@ -147,7 +148,13 @@ protected void onCreate(Bundle savedInstanceState) {
if (overrideSwipeFromAnywhere) {
shouldInterceptAlways = true;
} else {
mHelper.getSwipeBackLayout().setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);
if(verticalExit){
mHelper.getSwipeBackLayout().setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT | SwipeBackLayout.EDGE_BOTTOM | SwipeBackLayout.EDGE_TOP);
} else {
mHelper.getSwipeBackLayout()
.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT
| SwipeBackLayout.EDGE_TOP);
}
mHelper.getSwipeBackLayout().setFullScreenSwipeEnabled(true);
}
} else {
Expand Down Expand Up @@ -203,6 +210,10 @@ protected void overrideSwipeFromAnywhere() {
overrideSwipeFromAnywhere = true;
}

protected void swipeVerticalExit(){
verticalExit = true;
}

protected void overrideRedditSwipeAnywhere() {
overrideRedditSwipeAnywhere = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Locale;

import me.ccrama.redditslide.Notifications.CheckForMail;
import me.ccrama.redditslide.OpenRedditLink;
Expand All @@ -31,10 +32,10 @@ public void onCreate(Bundle savedInstance) {

if (extras != null) {
subName = extras.getString(EXTRA_SUB, "");
subName = subName.toLowerCase();
subName = subName.toLowerCase(Locale.ENGLISH);

ArrayList<String> subs = Reddit.stringToArray(
Reddit.appRestart.getString(CheckForMail.SUBS_TO_GET, "").toLowerCase());
Reddit.appRestart.getString(CheckForMail.SUBS_TO_GET, "").toLowerCase(Locale.ENGLISH));
String toRemove = "";

for(String s : subs){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import me.ccrama.redditslide.Adapters.MultiredditPosts;
import me.ccrama.redditslide.Adapters.SubmissionDisplay;
Expand Down Expand Up @@ -153,7 +154,7 @@ && getResources().getConfiguration().orientation
if (multireddit != null) {
subredditPosts = new MultiredditPosts(multireddit, profile);
} else {
baseSubreddit = subreddit.toLowerCase();
baseSubreddit = subreddit.toLowerCase(Locale.ENGLISH);
subredditPosts = new SubredditPosts(baseSubreddit, CommentsScreen.this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -102,7 +103,7 @@ public void onComplete(List<MultiReddit> multis) {
for (MultiReddit multiReddit : multis) {
if (multiReddit.getDisplayName().equals(multi)) {
for (MultiSubreddit sub : multiReddit.getSubreddits()) {
subs.add(sub.getDisplayName().toLowerCase());
subs.add(sub.getDisplayName().toLowerCase(Locale.ENGLISH));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import me.ccrama.redditslide.Authentication;
Expand Down Expand Up @@ -424,7 +425,7 @@ public void onClick(View v) {
startActivity(i);
}
});
final String host = URI.create(url).getHost().toLowerCase();
final String host = URI.create(url).getHost().toLowerCase(Locale.ENGLISH);

if (ContentType.hostContains(host, "imgur.com")) {
LogUtil.v("Imgur");
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/me/ccrama/redditslide/Activities/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

import me.ccrama.redditslide.Authentication;
Expand Down Expand Up @@ -120,7 +121,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
private void doSubStrings(ArrayList<Subreddit> subs) {
subNames = new CaseInsensitiveArrayList();
for (Subreddit s : subs) {
subNames.add(s.getDisplayName().toLowerCase());
subNames.add(s.getDisplayName().toLowerCase(Locale.ENGLISH));
}
subNames = UserSubscriptions.sort(subNames);
if (!subNames.contains("slideforreddit")) {
Expand Down Expand Up @@ -166,9 +167,9 @@ public void onClick(DialogInterface dialog, int which) {
.get("key_color")
.asText()
.isEmpty()
&& Palette.getColor(s.getDisplayName().toLowerCase()) == Palette
&& Palette.getColor(s.getDisplayName().toLowerCase(Locale.ENGLISH)) == Palette
.getDefaultColor()) {
Palette.setColor(s.getDisplayName().toLowerCase(),
Palette.setColor(s.getDisplayName().toLowerCase(Locale.ENGLISH),
GetClosestColor.getClosestColor(
s.getDataNode().get("key_color").asText(),
Login.this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ protected void onPostExecute(final Submission s) {
Reddit.appRestart.edit().putString("url", s.getUrl()).apply();

String title;
if (s.getTitle().toLowerCase().contains("release")) {
if (s.getTitle().toLowerCase(Locale.ENGLISH).contains("release")) {
title = getString(R.string.btn_changelog);
} else {
title = getString(R.string.btn_view);
Expand Down Expand Up @@ -2457,15 +2457,15 @@ public void doSubOnlyStuff(final Subreddit subreddit) {
for (String s : rawSubs) {
try {
String[] split = s.split(":");
subThresholds.put(split[0].toLowerCase(), Integer.valueOf(split[1]));
subThresholds.put(split[0].toLowerCase(Locale.ENGLISH), Integer.valueOf(split[1]));
} catch (Exception ignored) {
//do nothing
}
}

//whether or not this subreddit was in the keySet
boolean isNotified =
subThresholds.keySet().contains(subreddit.getDisplayName().toLowerCase());
subThresholds.keySet().contains(subreddit.getDisplayName().toLowerCase(Locale.ENGLISH));
((AppCompatCheckBox) findViewById(R.id.notify_posts_state)).setChecked(isNotified);
} else {
findViewById(R.id.sidebar_text).setVisibility(View.GONE);
Expand Down Expand Up @@ -2689,7 +2689,7 @@ public void onCancel(
{
final TextView subscribe = (TextView) findViewById(R.id.subscribe);
currentlySubbed = (!Authentication.isLoggedIn && usedArray.contains(
subreddit.getDisplayName().toLowerCase())) || subreddit.isUserSubscriber();
subreddit.getDisplayName().toLowerCase(Locale.ENGLISH))) || subreddit.isUserSubscriber();
doSubscribeButtonText(currentlySubbed, subscribe);

assert subscribe != null;
Expand Down Expand Up @@ -2915,7 +2915,7 @@ public void onClick(View v) {
if (!subreddit.getPublicDescription().isEmpty()) {
findViewById(R.id.sub_title).setVisibility(View.VISIBLE);
setViews(subreddit.getDataNode().get("public_description_html").asText(),
subreddit.getDisplayName().toLowerCase(),
subreddit.getDisplayName().toLowerCase(Locale.ENGLISH),
((SpoilerRobotoTextView) findViewById(R.id.sub_title)),
(CommentOverflow) findViewById(R.id.sub_title_overflow));
} else {
Expand Down Expand Up @@ -3073,8 +3073,8 @@ public void onClick(DialogInterface dialogInterface, int i) {
builder.setNegativeButton("Reset default sorting", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SettingValues.prefs.edit().remove("defaultSort" + subreddit.toLowerCase()).apply();
SettingValues.prefs.edit().remove("defaultTime" + subreddit.toLowerCase()).apply();
SettingValues.prefs.edit().remove("defaultSort" + subreddit.toLowerCase(Locale.ENGLISH)).apply();
SettingValues.prefs.edit().remove("defaultTime" + subreddit.toLowerCase(Locale.ENGLISH)).apply();
final TextView sort = (TextView) dialoglayout.findViewById(R.id.sort);
if(SettingValues.hasSort(subreddit)) {
Sorting sortingis = SettingValues.getBaseSubmissionSort(subreddit);
Expand Down Expand Up @@ -3599,13 +3599,13 @@ public void run() {

public void filterContent(final String subreddit) {
final boolean[] chosen = new boolean[]{
PostMatch.isImage(subreddit.toLowerCase()),
PostMatch.isAlbums(subreddit.toLowerCase()),
PostMatch.isGif(subreddit.toLowerCase()),
PostMatch.isVideo(subreddit.toLowerCase()),
PostMatch.isUrls(subreddit.toLowerCase()),
PostMatch.isSelftext(subreddit.toLowerCase()),
PostMatch.isNsfw(subreddit.toLowerCase())
PostMatch.isImage(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isAlbums(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isGif(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isVideo(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isUrls(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isSelftext(subreddit.toLowerCase(Locale.ENGLISH)),
PostMatch.isNsfw(subreddit.toLowerCase(Locale.ENGLISH))
};

final String currentSubredditName = usedArray.get(Reddit.currentPosition);
Expand Down Expand Up @@ -4051,7 +4051,7 @@ public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
if (sideArrayAdapter.fitems == null
|| sideArrayAdapter.openInSubView
|| !usedArray.contains(
drawerSearch.getText().toString().toLowerCase())) {
drawerSearch.getText().toString().toLowerCase(Locale.ENGLISH))) {
Intent inte = new Intent(MainActivity.this, SubredditView.class);
inte.putExtra(SubredditView.EXTRA_SUBREDDIT,
drawerSearch.getText().toString());
Expand All @@ -4064,18 +4064,18 @@ public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
(usedArray.size() + 1);
adapter.notifyDataSetChanged();
if (usedArray.contains(
drawerSearch.getText().toString().toLowerCase())) {
drawerSearch.getText().toString().toLowerCase(Locale.ENGLISH))) {
doPageSelectedComments(usedArray.indexOf(
drawerSearch.getText().toString().toLowerCase()));
drawerSearch.getText().toString().toLowerCase(Locale.ENGLISH)));
} else {
doPageSelectedComments(
usedArray.indexOf(sideArrayAdapter.fitems.get(0)));
}
}
if (usedArray.contains(
drawerSearch.getText().toString().toLowerCase())) {
drawerSearch.getText().toString().toLowerCase(Locale.ENGLISH))) {
pager.setCurrentItem(usedArray.indexOf(
drawerSearch.getText().toString().toLowerCase()));
drawerSearch.getText().toString().toLowerCase(Locale.ENGLISH)));
} else {
pager.setCurrentItem(
usedArray.indexOf(sideArrayAdapter.fitems.get(0)));
Expand Down Expand Up @@ -4373,10 +4373,10 @@ public void onAnimationUpdate(ValueAnimator valueAnimator) {
private void changeSubscription(Subreddit subreddit, boolean isChecked) {
currentlySubbed = isChecked;
if (isChecked) {
UserSubscriptions.addSubreddit(subreddit.getDisplayName().toLowerCase(),
UserSubscriptions.addSubreddit(subreddit.getDisplayName().toLowerCase(Locale.ENGLISH),
MainActivity.this);
} else {
UserSubscriptions.removeSubreddit(subreddit.getDisplayName().toLowerCase(),
UserSubscriptions.removeSubreddit(subreddit.getDisplayName().toLowerCase(Locale.ENGLISH),
MainActivity.this);
pager.setCurrentItem(pager.getCurrentItem() - 1);
restartTheme();
Expand Down Expand Up @@ -4610,7 +4610,7 @@ public boolean onEditorAction(TextView arg0, int arg1,
|| !usedArray.contains(
GO_TO_SUB_FIELD.getText()
.toString()
.toLowerCase())) {
.toLowerCase(Locale.ENGLISH))) {
Intent intent =
new Intent(MainActivity.this,
SubredditView.class);
Expand All @@ -4632,12 +4632,12 @@ public boolean onEditorAction(TextView arg0, int arg1,
if (usedArray.contains(
GO_TO_SUB_FIELD.getText()
.toString()
.toLowerCase())) {
.toLowerCase(Locale.ENGLISH))) {
doPageSelectedComments(
usedArray.indexOf(
GO_TO_SUB_FIELD.getText()
.toString()
.toLowerCase()));
.toLowerCase(Locale.ENGLISH)));
} else {
doPageSelectedComments(
usedArray.indexOf(
Expand All @@ -4648,11 +4648,11 @@ public boolean onEditorAction(TextView arg0, int arg1,
if (usedArray.contains(
GO_TO_SUB_FIELD.getText()
.toString()
.toLowerCase())) {
.toLowerCase(Locale.ENGLISH))) {
pager.setCurrentItem(usedArray.indexOf(
GO_TO_SUB_FIELD.getText()
.toString()
.toLowerCase()));
.toLowerCase(Locale.ENGLISH)));
} else {
pager.setCurrentItem(usedArray.indexOf(
sideArrayAdapter.fitems.get(
Expand Down Expand Up @@ -5260,8 +5260,8 @@ public void onPageScrolled(int position, float positionOffset,
.setDuration(180);
}
pager.setSwipeLeftOnly(true);
themeSystemBars(openingComments.getSubredditName().toLowerCase());
setRecentBar(openingComments.getSubredditName().toLowerCase());
themeSystemBars(openingComments.getSubredditName().toLowerCase(Locale.ENGLISH));
setRecentBar(openingComments.getSubredditName().toLowerCase(Locale.ENGLISH));
}
}
}
Expand Down
Loading

0 comments on commit a218426

Please sign in to comment.