Small fix for panel features

This commit is contained in:
tom79 2019-06-10 18:33:54 +02:00
parent f2544e5668
commit fc66974cf4
2 changed files with 64 additions and 53 deletions

View File

@ -137,6 +137,7 @@ public class Status implements Parcelable{
private int media_height;
private boolean cached = false;
private boolean autoHiddenCW = false;
private boolean customFeaturesDisplayed = false;
@Override
public void writeToParcel(Parcel dest, int flags) {
@ -197,6 +198,7 @@ public class Status implements Parcelable{
dest.writeInt(this.media_height);
dest.writeByte(this.cached ? (byte) 1 : (byte) 0);
dest.writeByte(this.autoHiddenCW ? (byte) 1 : (byte) 0);
dest.writeByte(this.customFeaturesDisplayed ? (byte) 1 : (byte) 0);
}
protected Status(Parcel in) {
@ -259,6 +261,7 @@ public class Status implements Parcelable{
this.media_height = in.readInt();
this.cached = in.readByte() != 0;
this.autoHiddenCW = in.readByte() != 0;
this.customFeaturesDisplayed = in.readByte() != 0;
}
public static final Creator<Status> CREATOR = new Creator<Status>() {
@ -1398,4 +1401,12 @@ public class Status implements Parcelable{
public void setAutoHiddenCW(boolean autoHiddenCW) {
this.autoHiddenCW = autoHiddenCW;
}
public boolean isCustomFeaturesDisplayed() {
return customFeaturesDisplayed;
}
public void setCustomFeaturesDisplayed(boolean customFeaturesDisplayed) {
this.customFeaturesDisplayed = customFeaturesDisplayed;
}
}

View File

@ -1000,61 +1000,61 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.fedilab_features.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (holder.fedilab_features_panel.getVisibility() != View.VISIBLE) {
holder.fedilab_features_panel.setVisibility(View.VISIBLE);
} else {
holder.fedilab_features_panel.setVisibility(View.GONE);
}
if (theme == Helper.THEME_LIGHT) {
holder.fedilab_features_panel.setBackgroundColor(ContextCompat.getColor(context, R.color.custom_features_panel_background_light));
}
if( !status.iscached()){
holder.custom_feature_cache.setVisibility(View.GONE);
}
if (status.isBookmarked())
holder.custom_feature_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_white_full));
else
holder.custom_feature_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_white));
holder.custom_feature_translate.setOnClickListener(view -> {
translateToot(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_bookmark.setOnClickListener(view -> {
bookmark(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_bookmark.setOnLongClickListener(view -> {
CrossActions.doCrossBookmark(context, status, statusListAdapter);
holder.fedilab_features_panel.setVisibility(View.GONE);
return false;
});
holder.custom_feature_timed_mute.setOnClickListener(view -> {
timedMuteAction(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_schedule.setOnClickListener(view -> {
scheduleBoost(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_mention.setOnClickListener(view -> {
mention(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_cache.setOnClickListener(view -> {
new ManageCachedStatusAsyncTask(context, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
status.setCustomFeaturesDisplayed(!status.isCustomFeaturesDisplayed());
notifyStatusChanged(status);
}
});
if (status.isCustomFeaturesDisplayed()) {
holder.fedilab_features_panel.setVisibility(View.VISIBLE);
} else {
holder.fedilab_features_panel.setVisibility(View.GONE);
}
if (theme == Helper.THEME_LIGHT) {
holder.fedilab_features_panel.setBackgroundColor(ContextCompat.getColor(context, R.color.custom_features_panel_background_light));
}
if( !status.iscached()){
holder.custom_feature_cache.setVisibility(View.GONE);
}
if (status.isBookmarked())
holder.custom_feature_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_white_full));
else
holder.custom_feature_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_white));
holder.custom_feature_translate.setOnClickListener(view -> {
translateToot(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_bookmark.setOnClickListener(view -> {
bookmark(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_bookmark.setOnLongClickListener(view -> {
CrossActions.doCrossBookmark(context, status, statusListAdapter);
holder.fedilab_features_panel.setVisibility(View.GONE);
return false;
});
holder.custom_feature_timed_mute.setOnClickListener(view -> {
timedMuteAction(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_schedule.setOnClickListener(view -> {
scheduleBoost(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_mention.setOnClickListener(view -> {
mention(status);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
holder.custom_feature_cache.setOnClickListener(view -> {
new ManageCachedStatusAsyncTask(context, status.getId(), StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
holder.fedilab_features_panel.setVisibility(View.GONE);
});
}