Browse Source

diasble shouting for guests

pull/61/merge
Thodoris1999 6 years ago
parent
commit
72cd619dd1
  1. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  2. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java
  3. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxTask.java
  4. 3
      app/src/main/res/layout/fragment_shoutbox.xml

2
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -224,7 +224,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
} }
else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2) { else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2) {
sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD"); sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD");
tabLayout.getTabAt(3).setIcon(R.drawable.ic_fiber_new_white_24dp); tabLayout.getTabAt(2).setIcon(R.drawable.ic_fiber_new_white_24dp);
} }
} }
//-------------------------------FragmentPagerAdapter END------------------------------------------- //-------------------------------FragmentPagerAdapter END-------------------------------------------

2
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java

@ -154,6 +154,8 @@ public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKey
progressBar.setVisibility(View.INVISIBLE); progressBar.setVisibility(View.INVISIBLE);
if (resultCode == NetworkResultCodes.SUCCESSFUL) { if (resultCode == NetworkResultCodes.SUCCESSFUL) {
shoutboxViewModel.setShoutbox(shoutbox); shoutboxViewModel.setShoutbox(shoutbox);
if (shoutbox.getShoutSend() != null)
editorView.setVisibility(View.VISIBLE);
} else if (resultCode == NetworkResultCodes.NETWORK_ERROR) { } else if (resultCode == NetworkResultCodes.NETWORK_ERROR) {
Timber.w("Failed to retreive shoutbox due to network error"); Timber.w("Failed to retreive shoutbox due to network error");
Toast.makeText(getContext(), "NetworkError", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "NetworkError", Toast.LENGTH_SHORT).show();

5
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxTask.java

@ -46,7 +46,10 @@ public class ShoutboxTask extends NewParseTask<Shoutbox> {
String sc = shoutboxForm.select("input[name=sc]").first().attr("value"); String sc = shoutboxForm.select("input[name=sc]").first().attr("value");
String shoutName = shoutboxForm.select("input[name=tp-shout-name]").first().attr("value"); String shoutName = shoutboxForm.select("input[name=tp-shout-name]").first().attr("value");
// TODO: make shout send nullable and disable shouting // TODO: make shout send nullable and disable shouting
String shoutSend = shoutboxForm.select("input[name=shout_send]").first().attr("value"); Element shoutSendInput = shoutboxForm.select("input[name=shout_send]").first();
String shoutSend = null;
if (shoutSendInput != null)
shoutSend = shoutSendInput.attr("value");
String shoutUrl = shoutboxForm.select("input[name=tp-shout-url]").first().attr("value"); String shoutUrl = shoutboxForm.select("input[name=tp-shout-url]").first().attr("value");
return new Shoutbox(shouts.toArray(new Shout[0]), sc, formUrl, shoutName, shoutSend, shoutUrl); return new Shoutbox(shouts.toArray(new Shout[0]), sc, formUrl, shoutName, shoutSend, shoutUrl);
} }

3
app/src/main/res/layout/fragment_shoutbox.xml

@ -29,7 +29,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:paddingTop="8dp" /> android:paddingTop="8dp"
android:visibility="gone"/>
<gr.thmmy.mthmmy.editorview.EmojiKeyboard <gr.thmmy.mthmmy.editorview.EmojiKeyboard
android:id="@+id/emoji_keyboard" android:id="@+id/emoji_keyboard"

Loading…
Cancel
Save