|
@ -3,7 +3,6 @@ package gr.thmmy.mthmmy.activities.board; |
|
|
import android.content.Context; |
|
|
import android.content.Context; |
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.graphics.Typeface; |
|
|
import android.graphics.Typeface; |
|
|
import android.os.Build; |
|
|
|
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
@ -104,7 +103,7 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
context.startActivity(intent); |
|
|
context.startActivity(intent); |
|
|
}); |
|
|
}); |
|
|
if (boardExpandableVisibility.get(subBoardViewHolder.getAdapterPosition())) { |
|
|
if (boardExpandableVisibility.get(subBoardViewHolder.getBindingAdapterPosition())) { |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
} |
|
|
} |
|
@ -113,7 +112,9 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
} |
|
|
} |
|
|
subBoardViewHolder.showHideExpandable.setOnClickListener(view -> { |
|
|
subBoardViewHolder.showHideExpandable.setOnClickListener(view -> { |
|
|
final boolean visible = boardExpandableVisibility.get(subBoardViewHolder.getAdapterPosition()); |
|
|
final int pos = subBoardViewHolder.getBindingAdapterPosition(); |
|
|
|
|
|
if (pos >=0 && pos < boardExpandableVisibility.size()){ |
|
|
|
|
|
final boolean visible = boardExpandableVisibility.get(subBoardViewHolder.getBindingAdapterPosition()); |
|
|
if (visible) { |
|
|
if (visible) { |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.GONE); |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.GONE); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
@ -122,7 +123,8 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); |
|
|
subBoardViewHolder.boardExpandable.setVisibility(View.VISIBLE); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
subBoardViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
} |
|
|
} |
|
|
boardExpandableVisibility.set(subBoardViewHolder.getAdapterPosition(), !visible); |
|
|
boardExpandableVisibility.set(subBoardViewHolder.getBindingAdapterPosition(), !visible); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
subBoardViewHolder.boardTitle.setText(subBoard.getTitle()); |
|
|
subBoardViewHolder.boardTitle.setText(subBoard.getTitle()); |
|
|
String mods = subBoard.getMods(); |
|
|
String mods = subBoard.getMods(); |
|
@ -174,7 +176,7 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
|
|
context.startActivity(intent); |
|
|
context.startActivity(intent); |
|
|
}); |
|
|
}); |
|
|
if (topicExpandableVisibility.get(topicViewHolder.getAdapterPosition() - parsedSubBoards |
|
|
if (topicExpandableVisibility.get(topicViewHolder.getBindingAdapterPosition() - parsedSubBoards |
|
|
.size())) { |
|
|
.size())) { |
|
|
topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); |
|
|
topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
@ -184,8 +186,10 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
} |
|
|
} |
|
|
topicViewHolder.showHideExpandable.setOnClickListener(view -> { |
|
|
topicViewHolder.showHideExpandable.setOnClickListener(view -> { |
|
|
|
|
|
final int pos = topicViewHolder.getBindingAdapterPosition() - parsedSubBoards.size(); |
|
|
|
|
|
if (pos >=0 && pos < topicExpandableVisibility.size()) { |
|
|
final boolean visible = topicExpandableVisibility.get(topicViewHolder. |
|
|
final boolean visible = topicExpandableVisibility.get(topicViewHolder. |
|
|
getAdapterPosition() - parsedSubBoards.size()); |
|
|
getBindingAdapterPosition() - parsedSubBoards.size()); |
|
|
if (visible) { |
|
|
if (visible) { |
|
|
topicViewHolder.topicExpandable.setVisibility(View.GONE); |
|
|
topicViewHolder.topicExpandable.setVisibility(View.GONE); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_down_accent_24dp); |
|
@ -194,17 +198,17 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { |
|
|
topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); |
|
|
topicViewHolder.topicExpandable.setVisibility(View.VISIBLE); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
topicViewHolder.showHideExpandable.setImageResource(R.drawable.ic_arrow_drop_up_accent_24dp); |
|
|
} |
|
|
} |
|
|
topicExpandableVisibility.set(topicViewHolder.getAdapterPosition() - |
|
|
topicExpandableVisibility.set(topicViewHolder.getBindingAdapterPosition() - |
|
|
parsedSubBoards.size(), !visible); |
|
|
parsedSubBoards.size(), !visible); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
topicViewHolder.topicSubject.setTypeface(Typeface.createFromAsset(context.getAssets() |
|
|
topicViewHolder.topicSubject.setTypeface(Typeface.createFromAsset(context.getAssets() |
|
|
, "fonts/fontawesome-webfont.ttf")); |
|
|
, "fonts/fontawesome-webfont.ttf")); |
|
|
topicViewHolder.topicUnreadDot.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/fontawesome-webfont.ttf")); |
|
|
topicViewHolder.topicUnreadDot.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/fontawesome-webfont.ttf")); |
|
|
if (topic.isUnread()) |
|
|
if (topic.isUnread()) |
|
|
topicViewHolder.topicUnreadDot.setVisibility(View.VISIBLE); |
|
|
topicViewHolder.topicUnreadDot.setVisibility(View.VISIBLE); |
|
|
else { |
|
|
else |
|
|
topicViewHolder.topicUnreadDot.setVisibility(View.GONE); |
|
|
topicViewHolder.topicUnreadDot.setVisibility(View.GONE); |
|
|
} |
|
|
|
|
|
String lockedSticky = topic.getSubject(); |
|
|
String lockedSticky = topic.getSubject(); |
|
|
if (topic.isLocked()) |
|
|
if (topic.isLocked()) |
|
|
lockedSticky += " " + context.getResources().getString(R.string.fa_lock); |
|
|
lockedSticky += " " + context.getResources().getString(R.string.fa_lock); |
|
|