use of android.support.v7.view.ContextThemeWrapper in project Slide by ccrama.
the class SubredditView method onPrepareOptionsMenu.
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// Hide the "Submit" menu item if the currently viewed sub is the frontpage or /r/all.
if (subreddit.equals("frontpage") || subreddit.equals("all") || subreddit.equals("popular") || subreddit.equals("friends") || subreddit.equals("mod")) {
menu.findItem(R.id.submit).setVisible(false);
menu.findItem(R.id.sidebar).setVisible(false);
}
mToolbar.getMenu().findItem(R.id.theme).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
int style = new ColorPreferences(SubredditView.this).getThemeSubreddit(subreddit);
final Context contextThemeWrapper = new ContextThemeWrapper(SubredditView.this, style);
LayoutInflater localInflater = getLayoutInflater().cloneInContext(contextThemeWrapper);
final View dialoglayout = localInflater.inflate(R.layout.colorsub, null);
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(subreddit);
SettingsSubAdapter.showSubThemeEditor(arrayList, SubredditView.this, dialoglayout);
return false;
}
});
return true;
}
use of android.support.v7.view.ContextThemeWrapper in project Slide by ccrama.
the class SubredditView method doSubSidebar.
public void doSubSidebar(final String subOverride) {
findViewById(R.id.loader).setVisibility(View.VISIBLE);
invalidateOptionsMenu();
if (!subOverride.equalsIgnoreCase("all") && !subOverride.equalsIgnoreCase("frontpage") && !subOverride.equalsIgnoreCase("random") && !subOverride.equalsIgnoreCase("popular") && !subOverride.equalsIgnoreCase("myrandom") && !subOverride.equalsIgnoreCase("randnsfw") && !subOverride.equalsIgnoreCase("friends") && !subOverride.equalsIgnoreCase("mod") && !subOverride.contains("+") && !subOverride.contains(".") && !subOverride.contains("/m/")) {
if (drawerLayout != null) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END);
}
loaded = true;
final View dialoglayout = findViewById(R.id.sidebarsub);
{
View submit = (dialoglayout.findViewById(R.id.submit));
if (!Authentication.isLoggedIn || !Authentication.didOnline) {
submit.setVisibility(View.GONE);
}
if (SettingValues.fab && SettingValues.fabType == Constants.FAB_POST) {
submit.setVisibility(View.GONE);
}
submit.setOnClickListener(new OnSingleClickListener() {
@Override
public void onSingleClick(View view) {
Intent inte = new Intent(SubredditView.this, Submit.class);
if (!subOverride.contains("/m/") && canSubmit) {
inte.putExtra(Submit.EXTRA_SUBREDDIT, subOverride);
}
SubredditView.this.startActivity(inte);
}
});
}
dialoglayout.findViewById(R.id.wiki).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(SubredditView.this, Wiki.class);
i.putExtra(Wiki.EXTRA_SUBREDDIT, subOverride);
startActivity(i);
}
});
dialoglayout.findViewById(R.id.syncflair).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageFlairs.syncFlairs(SubredditView.this, subreddit);
}
});
dialoglayout.findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(SubredditView.this, Submit.class);
if ((!subOverride.contains("/m/") || !subOverride.contains(".")) && canSubmit) {
i.putExtra(Submit.EXTRA_SUBREDDIT, subOverride);
}
startActivity(i);
}
});
final TextView sort = (TextView) dialoglayout.findViewById(R.id.sort);
Sorting sortingis = Sorting.HOT;
if (SettingValues.hasSort(subreddit)) {
sortingis = SettingValues.getBaseSubmissionSort(subreddit);
sort.setText(sortingis.name() + ((sortingis == Sorting.CONTROVERSIAL || sortingis == Sorting.TOP) ? " of " + SettingValues.getBaseTimePeriod(subreddit).name() : ""));
} else {
sort.setText("Set default sorting");
}
final int sortid = Reddit.getSortingId(sortingis);
dialoglayout.findViewById(R.id.sorting).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DialogInterface.OnClickListener l2 = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
switch(i) {
case 0:
sorts = Sorting.HOT;
break;
case 1:
sorts = Sorting.NEW;
break;
case 2:
sorts = Sorting.RISING;
break;
case 3:
sorts = Sorting.TOP;
askTimePeriod(sorts, subreddit, dialoglayout);
return;
case 4:
sorts = Sorting.CONTROVERSIAL;
askTimePeriod(sorts, subreddit, dialoglayout);
return;
}
SettingValues.setSubSorting(sorts, time, subreddit);
Sorting sortingis = SettingValues.getBaseSubmissionSort(subreddit);
sort.setText(sortingis.name() + ((sortingis == Sorting.CONTROVERSIAL || sortingis == Sorting.TOP) ? " of " + SettingValues.getBaseTimePeriod(subreddit).name() : ""));
reloadSubs();
}
};
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(SubredditView.this);
builder.setTitle(R.string.sorting_choose);
builder.setSingleChoiceItems(Reddit.getSortingStrings(getBaseContext()), sortid, l2);
builder.setNegativeButton("Reset default sorting", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
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);
sort.setText(sortingis.name() + ((sortingis == Sorting.CONTROVERSIAL || sortingis == Sorting.TOP) ? " of " + SettingValues.getBaseTimePeriod(subreddit).name() : ""));
} else {
sort.setText("Set default sorting");
}
reloadSubs();
}
});
builder.show();
}
});
dialoglayout.findViewById(R.id.theme).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int style = new ColorPreferences(SubredditView.this).getThemeSubreddit(subOverride);
final Context contextThemeWrapper = new ContextThemeWrapper(SubredditView.this, style);
LayoutInflater localInflater = getLayoutInflater().cloneInContext(contextThemeWrapper);
final View dialoglayout = localInflater.inflate(R.layout.colorsub, null);
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(subOverride);
SettingsSubAdapter.showSubThemeEditor(arrayList, SubredditView.this, dialoglayout);
}
});
dialoglayout.findViewById(R.id.mods).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Dialog d = new MaterialDialog.Builder(SubredditView.this).title(R.string.sidebar_findingmods).cancelable(true).content(R.string.misc_please_wait).progress(true, 100).show();
new AsyncTask<Void, Void, Void>() {
ArrayList<UserRecord> mods;
@Override
protected Void doInBackground(Void... params) {
mods = new ArrayList<>();
UserRecordPaginator paginator = new UserRecordPaginator(Authentication.reddit, subOverride, "moderators");
paginator.setSorting(Sorting.HOT);
paginator.setTimePeriod(TimePeriod.ALL);
while (paginator.hasNext()) {
mods.addAll(paginator.next());
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
final ArrayList<String> names = new ArrayList<>();
for (UserRecord rec : mods) {
names.add(rec.getFullName());
}
d.dismiss();
new MaterialDialog.Builder(SubredditView.this).title(getString(R.string.sidebar_submods, subreddit)).items(names).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
Intent i = new Intent(SubredditView.this, Profile.class);
i.putExtra(Profile.EXTRA_PROFILE, names.get(which));
startActivity(i);
}
}).positiveText(R.string.btn_message).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent i = new Intent(SubredditView.this, SendMessage.class);
i.putExtra(SendMessage.EXTRA_NAME, "/r/" + subOverride);
startActivity(i);
}
}).show();
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
dialoglayout.findViewById(R.id.flair).setVisibility(View.GONE);
if (Authentication.didOnline && Authentication.isLoggedIn) {
new AsyncTask<View, Void, View>() {
List<FlairTemplate> flairs;
ArrayList<String> flairText;
String current;
AccountManager m;
@Override
protected View doInBackground(View... params) {
try {
m = new AccountManager(Authentication.reddit);
JsonNode node = m.getFlairChoicesRootNode(subOverride, null);
flairs = m.getFlairChoices(subOverride, node);
FlairTemplate currentF = m.getCurrentFlair(subOverride, node);
if (currentF != null) {
if (currentF.getText().isEmpty()) {
current = ("[" + currentF.getCssClass() + "]");
} else {
current = (currentF.getText());
}
}
flairText = new ArrayList<>();
for (FlairTemplate temp : flairs) {
if (temp.getText().isEmpty()) {
flairText.add("[" + temp.getCssClass() + "]");
} else {
flairText.add(temp.getText());
}
}
} catch (Exception e1) {
e1.printStackTrace();
}
return params[0];
}
@Override
protected void onPostExecute(View flair) {
if (flairs != null && !flairs.isEmpty() && flairText != null && !flairText.isEmpty()) {
flair.setVisibility(View.VISIBLE);
if (current != null) {
((TextView) dialoglayout.findViewById(R.id.flair_text)).setText(getString(R.string.sidebar_flair, current));
}
flair.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new MaterialDialog.Builder(SubredditView.this).items(flairText).title(R.string.sidebar_select_flair).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
final FlairTemplate t = flairs.get(which);
if (t.isTextEditable()) {
new MaterialDialog.Builder(SubredditView.this).title(R.string.sidebar_select_flair_text).input(getString(R.string.mod_flair_hint), t.getText(), true, new MaterialDialog.InputCallback() {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
}
}).positiveText(R.string.btn_set).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(MaterialDialog dialog, DialogAction which) {
final String flair = dialog.getInputEditText().getText().toString();
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
try {
new ModerationManager(Authentication.reddit).setFlair(subOverride, t, flair, Authentication.name);
FlairTemplate currentF = m.getCurrentFlair(subOverride);
if (currentF.getText().isEmpty()) {
current = ("[" + currentF.getCssClass() + "]");
} else {
current = (currentF.getText());
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
protected void onPostExecute(Boolean done) {
Snackbar s;
if (done) {
if (current != null) {
((TextView) dialoglayout.findViewById(R.id.flair_text)).setText(getString(R.string.sidebar_flair, current));
}
s = Snackbar.make(mToolbar, R.string.snackbar_flair_success, Snackbar.LENGTH_SHORT);
} else {
s = Snackbar.make(mToolbar, R.string.snackbar_flair_error, Snackbar.LENGTH_SHORT);
}
if (s != null) {
View view = s.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
s.show();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}).negativeText(R.string.btn_cancel).show();
} else {
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
try {
new ModerationManager(Authentication.reddit).setFlair(subOverride, t, null, Authentication.name);
FlairTemplate currentF = m.getCurrentFlair(subOverride);
if (currentF.getText().isEmpty()) {
current = ("[" + currentF.getCssClass() + "]");
} else {
current = (currentF.getText());
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
protected void onPostExecute(Boolean done) {
Snackbar s;
if (done) {
if (current != null) {
((TextView) dialoglayout.findViewById(R.id.flair_text)).setText(getString(R.string.sidebar_flair, current));
}
s = Snackbar.make(mToolbar, R.string.snackbar_flair_success, Snackbar.LENGTH_SHORT);
} else {
s = Snackbar.make(mToolbar, R.string.snackbar_flair_error, Snackbar.LENGTH_SHORT);
}
if (s != null) {
View view = s.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
s.show();
}
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}).show();
}
});
}
}
}.execute(dialoglayout.findViewById(R.id.flair));
}
} else {
if (drawerLayout != null) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END);
}
}
}
use of android.support.v7.view.ContextThemeWrapper in project Slide by ccrama.
the class CommentPage method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
v = localInflater.inflate(R.layout.fragment_verticalcontenttoolbar, container, false);
rv = (RecyclerView) v.findViewById(R.id.vertical_content);
rv.setLayoutManager(mLayoutManager);
rv.getLayoutManager().scrollToPosition(0);
toolbar = (Toolbar) v.findViewById(R.id.toolbar);
toolbar.setPopupTheme(new ColorPreferences(getActivity()).getFontStyle().getBaseId());
if (!SettingValues.fabComments) {
v.findViewById(R.id.comment_floating_action_button).setVisibility(View.GONE);
} else {
fab = (FloatingActionButton) v.findViewById(R.id.comment_floating_action_button);
if (SettingValues.fastscroll) {
FrameLayout.LayoutParams fabs = (FrameLayout.LayoutParams) fab.getLayoutParams();
fabs.setMargins(fabs.leftMargin, fabs.topMargin, fabs.rightMargin, fabs.bottomMargin * 3);
fab.setLayoutParams(fabs);
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater = getActivity().getLayoutInflater();
final View dialoglayout = inflater.inflate(R.layout.edit_comment, null);
final AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
final EditText e = (EditText) dialoglayout.findViewById(R.id.entry);
// Tint the replyLine appropriately if the base theme is Light or Sepia
if (SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5) {
final int TINT = ContextCompat.getColor(getContext(), R.color.md_grey_600);
e.setHintTextColor(TINT);
e.getBackground().setColorFilter(TINT, PorterDuff.Mode.SRC_IN);
}
DoEditorActions.doActions(e, dialoglayout, getActivity().getSupportFragmentManager(), getActivity(), adapter.submission.isSelfPost() ? adapter.submission.getSelftext() : null, new String[] { adapter.submission.getAuthor() });
builder.setCancelable(false).setView(dialoglayout);
final Dialog d = builder.create();
d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
d.show();
dialoglayout.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
d.dismiss();
}
});
dialoglayout.findViewById(R.id.submit).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.dataSet.refreshLayout.setRefreshing(true);
new ReplyTaskComment(adapter.submission).execute(e.getText().toString());
d.dismiss();
}
});
}
});
}
if (fab != null)
fab.show();
resetScroll(false);
fastScroll = v.findViewById(R.id.commentnav);
if (!SettingValues.fastscroll) {
fastScroll.setVisibility(View.GONE);
} else {
v.findViewById(R.id.down).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (adapter != null && adapter.keys != null && adapter.keys.size() > 0) {
goDown();
}
}
});
v.findViewById(R.id.up).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (adapter != null && adapter.keys != null && adapter.keys.size() > 0)
goUp();
}
});
v.findViewById(R.id.nav).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (adapter != null && adapter.currentComments != null) {
int parentCount, opCount, linkCount, gildCount;
parentCount = 0;
opCount = 0;
linkCount = 0;
gildCount = 0;
String op = adapter.submission.getAuthor();
for (CommentObject o : adapter.currentComments) {
if (o.comment != null && !(o instanceof MoreChildItem)) {
if (o.comment.isTopLevel())
parentCount++;
if (o.comment.getComment().getTimesGilded() > 0)
gildCount++;
if (o.comment.getComment().getAuthor() != null && o.comment.getComment().getAuthor().equals(op)) {
opCount++;
}
if (o.comment.getComment().getDataNode().has("body_html") && o.comment.getComment().getDataNode().get("body_html").asText().contains("</a")) {
linkCount++;
}
}
}
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.set_nav_mode).setSingleChoiceItems(Reddit.stringToArray("Parent comment (" + parentCount + ")" + "," + "Children comment (highlight child comment & navigate)" + "," + "OP (" + opCount + ")" + "," + "Time" + "," + "Link (" + linkCount + ")" + "," + ((Authentication.isLoggedIn) ? "You" + "," : "") + "Gilded (" + gildCount + ")").toArray(new String[Authentication.isLoggedIn ? 6 : 5]), getCurrentSort(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which) {
case 0:
currentSort = CommentNavType.PARENTS;
break;
case 1:
currentSort = CommentNavType.CHILDREN;
break;
case 2:
currentSort = CommentNavType.OP;
break;
case 3:
currentSort = CommentNavType.TIME;
LayoutInflater inflater = getActivity().getLayoutInflater();
final View dialoglayout = inflater.inflate(R.layout.commenttime, null);
final AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
final Slider landscape = (Slider) dialoglayout.findViewById(R.id.landscape);
final TextView since = (TextView) dialoglayout.findViewById(R.id.time_string);
landscape.setValueRange(60, 18000, false);
landscape.setOnPositionChangeListener(new Slider.OnPositionChangeListener() {
@Override
public void onPositionChanged(Slider slider, boolean b, float v, float v1, int i, int i1) {
Calendar c = Calendar.getInstance();
sortTime = c.getTimeInMillis() - i1 * 1000;
int commentcount = 0;
for (CommentObject o : adapter.currentComments) {
if (o.comment != null && o.comment.getComment().getDataNode().has("created") && o.comment.getComment().getCreated().getTime() > sortTime) {
commentcount += 1;
}
}
since.setText(TimeUtils.getTimeAgo(sortTime, getActivity()) + " (" + commentcount + " comments)");
}
});
landscape.setValue(600, false);
builder.setView(dialoglayout);
builder.setPositiveButton(R.string.btn_set, null).show();
break;
case 5:
currentSort = CommentNavType.YOU;
break;
case 4:
currentSort = CommentNavType.LINK;
break;
case 6:
currentSort = CommentNavType.GILDED;
break;
}
}
}).show();
}
}
});
}
v.findViewById(R.id.up).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// Scroll to top
rv.getLayoutManager().scrollToPosition(1);
return true;
}
});
if (SettingValues.voteGestures) {
v.findViewById(R.id.up).setOnTouchListener(new OnFlingGestureListener() {
@Override
public void onRightToLeft() {
}
@Override
public void onLeftToRight() {
}
@Override
public void onBottomToTop() {
adapter.submissionViewHolder.upvote.performClick();
Context context = getContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text;
if (!upvoted) {
text = getString(R.string.profile_upvoted);
downvoted = false;
} else {
text = getString(R.string.vote_removed);
}
upvoted = !upvoted;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
@Override
public void onTopToBottom() {
}
});
}
if (SettingValues.voteGestures) {
v.findViewById(R.id.down).setOnTouchListener(new OnFlingGestureListener() {
@Override
public void onRightToLeft() {
}
@Override
public void onLeftToRight() {
}
@Override
public void onBottomToTop() {
adapter.submissionViewHolder.downvote.performClick();
Context context = getContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text;
if (!downvoted) {
text = getString(R.string.profile_downvoted);
upvoted = false;
} else {
text = getString(R.string.vote_removed);
}
downvoted = !downvoted;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
@Override
public void onTopToBottom() {
}
});
}
toolbar.setBackgroundColor(Palette.getColor(subreddit));
mSwipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.activity_main_swipe_refresh_layout);
mSwipeRefreshLayout.setColorSchemeColors(Palette.getColors(subreddit, getActivity()));
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (comments != null) {
comments.loadMore(adapter, subreddit, true);
} else {
mSwipeRefreshLayout.setRefreshing(false);
}
// TODO catch errors
}
});
toolbar.setTitle(subreddit);
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_material);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
toolbar.inflateMenu(R.menu.menu_comment_items);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.search:
{
if (comments.comments != null && comments.submission != null) {
DataShare.sharedComments = comments.comments;
DataShare.subAuthor = comments.submission.getAuthor();
Intent i = new Intent(getActivity(), CommentSearch.class);
if (getActivity() instanceof MainActivity) {
getActivity().startActivityForResult(i, 423);
} else {
startActivityForResult(i, 423);
}
}
}
return true;
case R.id.sidebar:
doSidebarOpen();
return true;
case R.id.related:
if (adapter.submission.isSelfPost()) {
new AlertDialogWrapper.Builder(getActivity()).setTitle("Selftext posts have no related submissions").setPositiveButton(R.string.btn_ok, null).show();
} else {
Intent i = new Intent(getActivity(), Related.class);
i.putExtra(Related.EXTRA_URL, adapter.submission.getUrl());
startActivity(i);
}
return true;
case R.id.shadowbox:
if (SettingValues.tabletUI) {
if (comments.comments != null && comments.submission != null) {
ShadowboxComments.comments = new ArrayList<>();
for (CommentObject c : comments.comments) {
if (c instanceof CommentItem) {
if (c.comment.getComment().getDataNode().get("body_html").asText().contains("</a")) {
String body = c.comment.getComment().getDataNode().get("body_html").asText();
String url;
String[] split = body.split("<a href=\"");
if (split.length > 1) {
for (String chunk : split) {
url = chunk.substring(0, chunk.indexOf("\"", 1));
ContentType.Type t = ContentType.getContentType(url);
if (ContentType.mediaType(t)) {
ShadowboxComments.comments.add(new CommentUrlObject(c.comment, url, subreddit));
}
}
} else {
int start = body.indexOf("<a href=\"");
url = body.substring(start, body.indexOf("\"", start + 1));
ContentType.Type t = ContentType.getContentType(url);
if (ContentType.mediaType(t)) {
ShadowboxComments.comments.add(new CommentUrlObject(c.comment, url, subreddit));
}
}
}
}
}
if (!ShadowboxComments.comments.isEmpty()) {
Intent i = new Intent(getActivity(), ShadowboxComments.class);
startActivity(i);
} else {
Snackbar.make(mSwipeRefreshLayout, R.string.shadowbox_comments_nolinks, Snackbar.LENGTH_SHORT).show();
}
}
} else {
AlertDialogWrapper.Builder b = new AlertDialogWrapper.Builder(getContext()).setTitle(R.string.general_shadowbox_comments_ispro).setMessage(R.string.pro_upgrade_msg).setPositiveButton(R.string.btn_yes_exclaim, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=me.ccrama.slideforreddittabletuiunlock")));
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=me.ccrama.slideforreddittabletuiunlock")));
}
}
}).setNegativeButton(R.string.btn_no_danks, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.dismiss();
}
});
b.show();
}
return true;
case R.id.sort:
{
openPopup(toolbar);
return true;
}
case R.id.content:
{
if (adapter != null && adapter.submission != null) {
if (!PostMatch.openExternal(adapter.submission.getUrl())) {
ContentType.Type type = ContentType.getContentType(adapter.submission);
switch(type) {
case VID_ME:
case STREAMABLE:
if (SettingValues.video) {
Intent myIntent = new Intent(getActivity(), MediaView.class);
myIntent.putExtra(MediaView.SUBREDDIT, subreddit);
myIntent.putExtra(MediaView.EXTRA_URL, adapter.submission.getUrl());
getActivity().startActivity(myIntent);
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
break;
case IMGUR:
case XKCD:
Intent i2 = new Intent(getActivity(), MediaView.class);
i2.putExtra(MediaView.SUBREDDIT, subreddit);
if (adapter.submission.getDataNode().has("preview") && adapter.submission.getDataNode().get("preview").get("images").get(0).get("source").has("height") && type != ContentType.Type.XKCD) {
// Load the preview image which has probably already been cached in memory instead of the direct link
String previewUrl = adapter.submission.getDataNode().get("preview").get("images").get(0).get("source").get("url").asText();
i2.putExtra(MediaView.EXTRA_DISPLAY_URL, previewUrl);
}
i2.putExtra(MediaView.EXTRA_URL, adapter.submission.getUrl());
getActivity().startActivity(i2);
break;
case EMBEDDED:
if (SettingValues.video) {
String data = adapter.submission.getDataNode().get("media_embed").get("content").asText();
{
Intent i = new Intent(getActivity(), FullscreenVideo.class);
i.putExtra(FullscreenVideo.EXTRA_HTML, data);
getActivity().startActivity(i);
}
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
break;
case REDDIT:
PopulateSubmissionViewHolder.openRedditContent(adapter.submission.getUrl(), getActivity());
break;
case LINK:
LinkUtil.openUrl(adapter.submission.getUrl(), Palette.getColor(adapter.submission.getSubredditName()), getActivity());
break;
case NONE:
case SELF:
if (adapter.submission.getSelftext().isEmpty()) {
Snackbar s = Snackbar.make(rv, R.string.submission_nocontent, Snackbar.LENGTH_SHORT);
View view = s.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
s.show();
} else {
LayoutInflater inflater = getActivity().getLayoutInflater();
final View dialoglayout = inflater.inflate(R.layout.parent_comment_dialog, null);
final AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
adapter.setViews(adapter.submission.getDataNode().get("selftext_html").asText(), adapter.submission.getSubredditName(), (SpoilerRobotoTextView) dialoglayout.findViewById(R.id.firstTextView), (CommentOverflow) dialoglayout.findViewById(R.id.commentOverflow));
builder.setView(dialoglayout);
builder.show();
}
break;
case ALBUM:
if (SettingValues.album) {
if (SettingValues.albumSwipe) {
Intent i = new Intent(getActivity(), AlbumPager.class);
i.putExtra(Album.EXTRA_URL, adapter.submission.getUrl());
i.putExtra(AlbumPager.SUBREDDIT, subreddit);
getActivity().startActivity(i);
getActivity().overridePendingTransition(R.anim.slideright, R.anim.fade_out);
} else {
Intent i = new Intent(getActivity(), Album.class);
i.putExtra(Album.EXTRA_URL, adapter.submission.getUrl());
i.putExtra(Album.SUBREDDIT, subreddit);
getActivity().startActivity(i);
getActivity().overridePendingTransition(R.anim.slideright, R.anim.fade_out);
}
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
break;
case TUMBLR:
if (SettingValues.image) {
if (SettingValues.albumSwipe) {
Intent i = new Intent(getActivity(), TumblrPager.class);
i.putExtra(Album.EXTRA_URL, adapter.submission.getUrl());
i.putExtra(TumblrPager.SUBREDDIT, subreddit);
getActivity().startActivity(i);
getActivity().overridePendingTransition(R.anim.slideright, R.anim.fade_out);
} else {
Intent i = new Intent(getActivity(), Tumblr.class);
i.putExtra(Tumblr.SUBREDDIT, subreddit);
i.putExtra(Album.EXTRA_URL, adapter.submission.getUrl());
getActivity().startActivity(i);
getActivity().overridePendingTransition(R.anim.slideright, R.anim.fade_out);
}
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
break;
case IMAGE:
PopulateSubmissionViewHolder.openImage(type, getActivity(), adapter.submission, null, -1);
break;
case VREDDIT_REDIRECT:
case VREDDIT_DIRECT:
case GIF:
PopulateSubmissionViewHolder.openGif(getActivity(), adapter.submission, -1);
break;
case VIDEO:
if (Reddit.videoPlugin) {
try {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setClassName("ccrama.me.slideyoutubeplugin", "ccrama.me.slideyoutubeplugin.YouTubeView");
sharingIntent.putExtra("url", adapter.submission.getUrl());
getActivity().startActivity(sharingIntent);
} catch (Exception e) {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
}
} else {
LinkUtil.openExternally(adapter.submission.getUrl(), getActivity());
}
}
}
return true;
case R.id.reload:
if (comments != null) {
mSwipeRefreshLayout.setRefreshing(true);
comments.loadMore(adapter, subreddit);
}
return true;
case R.id.collapse:
{
if (adapter != null) {
adapter.collapseAll();
}
}
return true;
case android.R.id.home:
getActivity().onBackPressed();
return true;
}
return false;
}
});
toolbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((LinearLayoutManager) rv.getLayoutManager()).scrollToPositionWithOffset(1, headerHeight);
resetScroll(false);
}
});
addClickFunctionSubName(toolbar);
doTopBar();
if (Authentication.didOnline && !NetworkUtil.isConnectedNoOverride(getActivity())) {
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.err_title).setMessage(R.string.err_connection_failed_msg).setNegativeButton(R.string.btn_close, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (!(getActivity() instanceof MainActivity)) {
getActivity().finish();
}
}
}).setPositiveButton(R.string.btn_offline, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Reddit.appRestart.edit().putBoolean("forceoffline", true).commit();
Reddit.forceRestart(getActivity());
}
}).show();
}
if (!(getActivity() instanceof CommentsScreen) || ((CommentsScreen) getActivity()).currentPage == page) {
doAdapter(true);
} else {
doAdapter(false);
}
return v;
}
use of android.support.v7.view.ContextThemeWrapper in project Slide by ccrama.
the class NewsView method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), new ColorPreferences(inflater.getContext()).getThemeSubreddit(id));
final View v = ((LayoutInflater) contextThemeWrapper.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.fragment_verticalcontent, container, false);
if (getActivity() instanceof MainActivity) {
v.findViewById(R.id.back).setBackgroundResource(0);
}
rv = v.findViewById(R.id.vertical_content);
rv.setHasFixedSize(true);
final RecyclerView.LayoutManager mLayoutManager;
mLayoutManager = createLayoutManager(getNumColumns(getResources().getConfiguration().orientation, getActivity()));
if (!(getActivity() instanceof SubredditView)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
v.findViewById(R.id.back).setBackground(null);
} else {
v.findViewById(R.id.back).setBackgroundDrawable(null);
}
}
rv.setLayoutManager(mLayoutManager);
rv.setItemAnimator(new SlideUpAlphaAnimator());
rv.getLayoutManager().scrollToPosition(0);
mSwipeRefreshLayout = v.findViewById(R.id.activity_main_swipe_refresh_layout);
mSwipeRefreshLayout.setColorSchemeColors(Palette.getColors(id, getContext()));
/**
* If using List view mode, we need to remove the start margin from the SwipeRefreshLayout.
* The scrollbar style of "outsideInset" creates a 4dp padding around it. To counter this,
* change the scrollbar style to "insideOverlay" when list view is enabled.
* To recap: this removes the margins from the start/end so list view is full-width.
*/
if (SettingValues.defaultCardView == CreateCardView.CardEnum.LIST) {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginStart(0);
} else {
MarginLayoutParamsCompat.setMarginStart(params, 0);
}
rv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mSwipeRefreshLayout.setLayoutParams(params);
}
/**
* If we use 'findViewById(R.id.header).getMeasuredHeight()', 0 is always returned.
* So, we estimate the height of the header in dp.
* If the view type is "single" (and therefore "commentPager"), we need a different offset
*/
final int HEADER_OFFSET = (SettingValues.single || getActivity() instanceof SubredditView) ? Constants.SINGLE_HEADER_VIEW_OFFSET : Constants.TAB_HEADER_VIEW_OFFSET;
mSwipeRefreshLayout.setProgressViewOffset(false, HEADER_OFFSET - Constants.PTR_OFFSET_TOP, HEADER_OFFSET + Constants.PTR_OFFSET_BOTTOM);
if (SettingValues.fab) {
fab = v.findViewById(R.id.post_floating_action_button);
if (SettingValues.fabType == Constants.FAB_POST) {
fab.setImageResource(R.drawable.add);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent inte = new Intent(getActivity(), Submit.class);
inte.putExtra(Submit.EXTRA_SUBREDDIT, id);
getActivity().startActivity(inte);
}
});
} else {
fab.setImageResource(R.drawable.hide);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!Reddit.fabClear) {
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.settings_fabclear).setMessage(R.string.settings_fabclear_msg).setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Reddit.colors.edit().putBoolean(SettingValues.PREF_FAB_CLEAR, true).apply();
Reddit.fabClear = true;
clearSeenPosts(false);
}
}).show();
} else {
clearSeenPosts(false);
}
}
});
final Handler handler = new Handler();
fab.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
detector.onTouchEvent(event);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
origY = event.getY();
handler.postDelayed(mLongPressRunnable, android.view.ViewConfiguration.getLongPressTimeout());
}
if (((event.getAction() == MotionEvent.ACTION_MOVE) && Math.abs(event.getY() - origY) > fab.getHeight() / 2) || (event.getAction() == MotionEvent.ACTION_UP)) {
handler.removeCallbacks(mLongPressRunnable);
}
return false;
}
});
mLongPressRunnable = new Runnable() {
public void run() {
fab.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (!Reddit.fabClear) {
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.settings_fabclear).setMessage(R.string.settings_fabclear_msg).setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Reddit.colors.edit().putBoolean(SettingValues.PREF_FAB_CLEAR, true).apply();
Reddit.fabClear = true;
clearSeenPosts(true);
}
}).show();
} else {
clearSeenPosts(true);
}
Snackbar s = Snackbar.make(rv, getResources().getString(R.string.posts_hidden_forever), Snackbar.LENGTH_LONG);
/*Todo a way to unhide
s.setAction(R.string.btn_undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});*/
View view = s.getView();
TextView tv = view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
s.show();
}
};
}
} else {
v.findViewById(R.id.post_floating_action_button).setVisibility(View.GONE);
}
if (fab != null)
fab.show();
header = getActivity().findViewById(R.id.header);
// TODO, have it so that if the user clicks anywhere in the rv to hide and cancel GoToSubreddit?
// final TextInputEditText GO_TO_SUB_FIELD = (TextInputEditText) getActivity().findViewById(R.id.toolbar_search);
// final Toolbar TOOLBAR = ((Toolbar) getActivity().findViewById(R.id.toolbar));
// final String PREV_TITLE = TOOLBAR.getTitle().toString();
// final ImageView CLOSE_BUTTON = (ImageView) getActivity().findViewById(R.id.close);
//
// rv.setOnTouchListener(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// System.out.println("touched");
// InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
// imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
//
// GO_TO_SUB_FIELD.setText("");
// GO_TO_SUB_FIELD.setVisibility(View.GONE);
// CLOSE_BUTTON.setVisibility(View.GONE);
// TOOLBAR.setTitle(PREV_TITLE);
//
// return false;
// }
// });
resetScroll();
Reddit.isLoading = false;
if (MainActivity.shouldLoad == null || id == null || (MainActivity.shouldLoad != null && MainActivity.shouldLoad.equals(id)) || !(getActivity() instanceof MainActivity)) {
doAdapter();
}
return v;
}
use of android.support.v7.view.ContextThemeWrapper in project Slide by ccrama.
the class SubmissionsView method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), new ColorPreferences(inflater.getContext()).getThemeSubreddit(id));
final View v = ((LayoutInflater) contextThemeWrapper.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.fragment_verticalcontent, container, false);
if (getActivity() instanceof MainActivity) {
v.findViewById(R.id.back).setBackgroundResource(0);
}
rv = v.findViewById(R.id.vertical_content);
rv.setHasFixedSize(true);
final RecyclerView.LayoutManager mLayoutManager;
mLayoutManager = createLayoutManager(getNumColumns(getResources().getConfiguration().orientation, getActivity()));
if (!(getActivity() instanceof SubredditView)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
v.findViewById(R.id.back).setBackground(null);
} else {
v.findViewById(R.id.back).setBackgroundDrawable(null);
}
}
rv.setLayoutManager(mLayoutManager);
rv.setItemAnimator(new SlideUpAlphaAnimator());
rv.getLayoutManager().scrollToPosition(0);
mSwipeRefreshLayout = v.findViewById(R.id.activity_main_swipe_refresh_layout);
mSwipeRefreshLayout.setColorSchemeColors(Palette.getColors(id, getContext()));
/**
* If using List view mode, we need to remove the start margin from the SwipeRefreshLayout.
* The scrollbar style of "outsideInset" creates a 4dp padding around it. To counter this,
* change the scrollbar style to "insideOverlay" when list view is enabled.
* To recap: this removes the margins from the start/end so list view is full-width.
*/
if (SettingValues.defaultCardView == CreateCardView.CardEnum.LIST) {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginStart(0);
} else {
MarginLayoutParamsCompat.setMarginStart(params, 0);
}
rv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
mSwipeRefreshLayout.setLayoutParams(params);
}
/**
* If we use 'findViewById(R.id.header).getMeasuredHeight()', 0 is always returned.
* So, we estimate the height of the header in dp.
* If the view type is "single" (and therefore "commentPager"), we need a different offset
*/
final int HEADER_OFFSET = (SettingValues.single || getActivity() instanceof SubredditView) ? Constants.SINGLE_HEADER_VIEW_OFFSET : Constants.TAB_HEADER_VIEW_OFFSET;
mSwipeRefreshLayout.setProgressViewOffset(false, HEADER_OFFSET - Constants.PTR_OFFSET_TOP, HEADER_OFFSET + Constants.PTR_OFFSET_BOTTOM);
if (SettingValues.fab) {
fab = v.findViewById(R.id.post_floating_action_button);
if (SettingValues.fabType == Constants.FAB_POST) {
fab.setImageResource(R.drawable.add);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent inte = new Intent(getActivity(), Submit.class);
inte.putExtra(Submit.EXTRA_SUBREDDIT, id);
getActivity().startActivity(inte);
}
});
} else {
fab.setImageResource(R.drawable.hide);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!Reddit.fabClear) {
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.settings_fabclear).setMessage(R.string.settings_fabclear_msg).setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Reddit.colors.edit().putBoolean(SettingValues.PREF_FAB_CLEAR, true).apply();
Reddit.fabClear = true;
clearSeenPosts(false);
}
}).show();
} else {
clearSeenPosts(false);
}
}
});
final Handler handler = new Handler();
fab.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
detector.onTouchEvent(event);
if (event.getAction() == MotionEvent.ACTION_DOWN) {
origY = event.getY();
handler.postDelayed(mLongPressRunnable, android.view.ViewConfiguration.getLongPressTimeout());
}
if (((event.getAction() == MotionEvent.ACTION_MOVE) && Math.abs(event.getY() - origY) > fab.getHeight() / 2) || (event.getAction() == MotionEvent.ACTION_UP)) {
handler.removeCallbacks(mLongPressRunnable);
}
return false;
}
});
mLongPressRunnable = new Runnable() {
public void run() {
fab.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
if (!Reddit.fabClear) {
new AlertDialogWrapper.Builder(getActivity()).setTitle(R.string.settings_fabclear).setMessage(R.string.settings_fabclear_msg).setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Reddit.colors.edit().putBoolean(SettingValues.PREF_FAB_CLEAR, true).apply();
Reddit.fabClear = true;
clearSeenPosts(true);
}
}).show();
} else {
clearSeenPosts(true);
}
Snackbar s = Snackbar.make(rv, getResources().getString(R.string.posts_hidden_forever), Snackbar.LENGTH_LONG);
/*Todo a way to unhide
s.setAction(R.string.btn_undo, new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});*/
View view = s.getView();
TextView tv = view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
s.show();
}
};
}
} else {
v.findViewById(R.id.post_floating_action_button).setVisibility(View.GONE);
}
if (fab != null)
fab.show();
header = getActivity().findViewById(R.id.header);
// TODO, have it so that if the user clicks anywhere in the rv to hide and cancel GoToSubreddit?
// final TextInputEditText GO_TO_SUB_FIELD = (TextInputEditText) getActivity().findViewById(R.id.toolbar_search);
// final Toolbar TOOLBAR = ((Toolbar) getActivity().findViewById(R.id.toolbar));
// final String PREV_TITLE = TOOLBAR.getTitle().toString();
// final ImageView CLOSE_BUTTON = (ImageView) getActivity().findViewById(R.id.close);
//
// rv.setOnTouchListener(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// System.out.println("touched");
// InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
// imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
//
// GO_TO_SUB_FIELD.setText("");
// GO_TO_SUB_FIELD.setVisibility(View.GONE);
// CLOSE_BUTTON.setVisibility(View.GONE);
// TOOLBAR.setTitle(PREV_TITLE);
//
// return false;
// }
// });
resetScroll();
Reddit.isLoading = false;
if (MainActivity.shouldLoad == null || id == null || (MainActivity.shouldLoad != null && MainActivity.shouldLoad.equals(id)) || !(getActivity() instanceof MainActivity)) {
doAdapter();
}
return v;
}
Aggregations