use of net.dean.jraw.models.MultiSubreddit in project Slide by ccrama.
the class UserSubscriptions method syncMultiReddits.
public static void syncMultiReddits(Context c) {
try {
multireddits = new ArrayList<>(new MultiRedditManager(Authentication.reddit).mine());
for (MultiReddit multiReddit : multireddits) {
if (MainActivity.multiNameToSubsMap.containsKey(ReorderSubreddits.MULTI_REDDIT + multiReddit.getDisplayName())) {
StringBuilder concatenatedSubs = new StringBuilder();
for (MultiSubreddit subreddit : multiReddit.getSubreddits()) {
concatenatedSubs.append(subreddit.getDisplayName());
concatenatedSubs.append("+");
}
MainActivity.multiNameToSubsMap.put(ReorderSubreddits.MULTI_REDDIT + multiReddit.getDisplayName(), concatenatedSubs.toString());
UserSubscriptions.setSubNameToProperties(ReorderSubreddits.MULTI_REDDIT + multiReddit.getDisplayName(), concatenatedSubs.toString());
}
}
} catch (ApiException e) {
e.printStackTrace();
} catch (NetworkException e) {
e.printStackTrace();
}
}
use of net.dean.jraw.models.MultiSubreddit in project Slide by ccrama.
the class CreateMulti method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
overrideRedditSwipeAnywhere();
super.onCreate(savedInstanceState);
applyColorTheme();
setContentView(R.layout.activity_createmulti);
setupAppBar(R.id.toolbar, "", true, true);
findViewById(R.id.add).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSelectDialog();
}
});
title = (EditText) findViewById(R.id.name);
subs = new ArrayList<>();
if (getIntent().hasExtra(EXTRA_MULTI)) {
final String multi = getIntent().getExtras().getString(EXTRA_MULTI);
old = multi;
title.setText(multi.replace("%20", " "));
UserSubscriptions.getMultireddits(new UserSubscriptions.MultiCallback() {
@Override
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(Locale.ENGLISH));
}
}
}
}
});
}
recyclerView = (RecyclerView) findViewById(R.id.subslist);
adapter = new CustomAdapter(subs);
// adapter.setHasStableIds(true);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
Aggregations