More Pixelfed improvements
This commit is contained in:
parent
97972cad4f
commit
ceb16a7b23
|
@ -57,7 +57,9 @@ android {
|
||||||
resValue "string", "app_name", "Fedilab"
|
resValue "string", "app_name", "Fedilab"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
playstore {
|
playstore {
|
||||||
manifest.srcFile "src/common/AndroidManifest.xml"
|
manifest.srcFile "src/common/AndroidManifest.xml"
|
||||||
|
|
|
@ -33,6 +33,7 @@ import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||||
|
|
||||||
public class StatusListAdapter extends BaseStatusListAdapter {
|
public class StatusListAdapter extends BaseStatusListAdapter {
|
||||||
|
|
||||||
public StatusListAdapter(StatusDrawerParams statusDrawerParams) {
|
public StatusListAdapter(StatusDrawerParams statusDrawerParams) {
|
||||||
super(statusDrawerParams);
|
super(statusDrawerParams);
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,11 @@
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:theme="@style/AppThemeDark_NoActionBar"
|
android:theme="@style/AppThemeDark_NoActionBar"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
|
<activity
|
||||||
|
android:name="app.fedilab.android.activities.LiveBookmarkActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
|
android:theme="@style/AppThemeDark_NoActionBar"
|
||||||
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name="app.fedilab.android.activities.SettingsActivity"
|
android:name="app.fedilab.android.activities.SettingsActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
|
|
|
@ -1777,6 +1777,10 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
Intent intent = new Intent(BaseMainActivity.this, BookmarkActivity.class);
|
Intent intent = new Intent(BaseMainActivity.this, BookmarkActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (id == R.id.nav_pixelfed_bookmarks) {
|
||||||
|
Intent intent = new Intent(BaseMainActivity.this, LiveBookmarkActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
final NavigationView navigationView = findViewById(R.id.nav_view);
|
final NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
Helper.unCheckAllMenuItems(navigationView);
|
Helper.unCheckAllMenuItems(navigationView);
|
||||||
|
@ -1800,7 +1804,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
toolbarTitle.setVisibility(View.VISIBLE);
|
toolbarTitle.setVisibility(View.VISIBLE);
|
||||||
delete_instance.setVisibility(View.GONE);
|
delete_instance.setVisibility(View.GONE);
|
||||||
appBar.setExpanded(true);
|
appBar.setExpanded(true);
|
||||||
if (id != R.id.nav_drafts && id != R.id.nav_pixelfed_drafts && id != R.id.nav_peertube) {
|
if (id != R.id.nav_drafts && id != R.id.nav_peertube) {
|
||||||
delete_all.hide();
|
delete_all.hide();
|
||||||
} else {
|
} else {
|
||||||
delete_all.show();
|
delete_all.show();
|
||||||
|
@ -1882,7 +1886,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
fragmentTag = "ANNOUNCEMENTS";
|
fragmentTag = "ANNOUNCEMENTS";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, statusFragment, fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_blocked || id == R.id.nav_pixelfed_blocked) {
|
} else if (id == R.id.nav_blocked) {
|
||||||
toot.hide();
|
toot.hide();
|
||||||
accountsFragment = new DisplayAccountsFragment();
|
accountsFragment = new DisplayAccountsFragment();
|
||||||
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.BLOCKED);
|
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.BLOCKED);
|
||||||
|
@ -1890,12 +1894,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
fragmentTag = "BLOCKS";
|
fragmentTag = "BLOCKS";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_how_to) {
|
|
||||||
toot.hide();
|
|
||||||
DisplayHowToFragment displayHowToFragment = new DisplayHowToFragment();
|
|
||||||
fragmentTag = "HOW_TO_VIDEOS";
|
|
||||||
fragmentManager.beginTransaction()
|
|
||||||
.replace(R.id.main_app_container, displayHowToFragment, fragmentTag).commit();
|
|
||||||
} else if (id == R.id.nav_muted) {
|
} else if (id == R.id.nav_muted) {
|
||||||
toot.hide();
|
toot.hide();
|
||||||
accountsFragment = new DisplayAccountsFragment();
|
accountsFragment = new DisplayAccountsFragment();
|
||||||
|
@ -1904,24 +1902,18 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
fragmentTag = "MUTED";
|
fragmentTag = "MUTED";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, accountsFragment, fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_scheduled || id == R.id.nav_pixelfed_scheduled) {
|
} else if (id == R.id.nav_scheduled) {
|
||||||
tootShow();
|
tootShow();
|
||||||
TabLayoutScheduleFragment tabLayoutScheduleFragment = new TabLayoutScheduleFragment();
|
TabLayoutScheduleFragment tabLayoutScheduleFragment = new TabLayoutScheduleFragment();
|
||||||
fragmentTag = "SCHEDULED";
|
fragmentTag = "SCHEDULED";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, tabLayoutScheduleFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, tabLayoutScheduleFragment, fragmentTag).commit();
|
||||||
} else if (id == R.id.nav_drafts || id == R.id.nav_pixelfed_drafts) {
|
} else if (id == R.id.nav_drafts) {
|
||||||
DisplayDraftsFragment displayDraftsFragment = new DisplayDraftsFragment();
|
DisplayDraftsFragment displayDraftsFragment = new DisplayDraftsFragment();
|
||||||
fragmentTag = "DRAFTS";
|
fragmentTag = "DRAFTS";
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.replace(R.id.main_app_container, displayDraftsFragment, fragmentTag).commit();
|
.replace(R.id.main_app_container, displayDraftsFragment, fragmentTag).commit();
|
||||||
toot.hide();
|
toot.hide();
|
||||||
} else if (id == R.id.nav_pixelfed_bookmarks) {
|
|
||||||
DisplayBookmarksPixelfedFragment displayBookmarksPixelfedFragment = new DisplayBookmarksPixelfedFragment();
|
|
||||||
fragmentTag = "BOOKMARKS";
|
|
||||||
fragmentManager.beginTransaction()
|
|
||||||
.replace(R.id.main_app_container, displayBookmarksPixelfedFragment, fragmentTag).commit();
|
|
||||||
toot.hide();
|
|
||||||
} else if (id == R.id.nav_peertube) {
|
} else if (id == R.id.nav_peertube) {
|
||||||
DisplayFavoritesPeertubeFragment displayFavoritesPeertubeFragment = new DisplayFavoritesPeertubeFragment();
|
DisplayFavoritesPeertubeFragment displayFavoritesPeertubeFragment = new DisplayFavoritesPeertubeFragment();
|
||||||
fragmentTag = "BOOKMARKS_PEERTUBE";
|
fragmentTag = "BOOKMARKS_PEERTUBE";
|
||||||
|
|
|
@ -47,7 +47,6 @@ import app.fedilab.android.R;
|
||||||
import app.fedilab.android.asynctasks.PostActionAsyncTask;
|
import app.fedilab.android.asynctasks.PostActionAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.SyncBookmarksAsyncTask;
|
import app.fedilab.android.asynctasks.SyncBookmarksAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
|
||||||
import app.fedilab.android.client.API;
|
import app.fedilab.android.client.API;
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
|
@ -132,28 +131,20 @@ public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case android.R.id.home:
|
if (itemId == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_export_bookmarks:
|
} else if (itemId == R.id.action_import_bookmarks) {
|
||||||
new SyncBookmarksAsyncTask(BookmarkActivity.this, SyncBookmarksAsyncTask.sync.EXPORT, BookmarkActivity.this);
|
new SyncBookmarksAsyncTask(BookmarkActivity.this, SyncBookmarksAsyncTask.sync.IMPORT, BookmarkActivity.this);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_import_bookmarks:
|
|
||||||
new SyncBookmarksAsyncTask(BookmarkActivity.this, SyncBookmarksAsyncTask.sync.IMPORT, BookmarkActivity.this);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.bookmarks, menu);
|
getMenuInflater().inflate(R.menu.bookmarks, menu);
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.MASTODON && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
|
||||||
menu.findItem(R.id.action_export_bookmarks).setVisible(false);
|
|
||||||
menu.findItem(R.id.action_import_bookmarks).setVisible(false);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright 2019 Thomas Schneider
|
/* Copyright 2021 Thomas Schneider
|
||||||
*
|
*
|
||||||
* This file is a part of Fedilab
|
* This file is a part of Fedilab
|
||||||
*
|
*
|
||||||
|
@ -14,65 +14,69 @@
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
package app.fedilab.android.activities;
|
package app.fedilab.android.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.ListPreloader;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import com.bumptech.glide.RequestBuilder;
|
||||||
|
import com.bumptech.glide.integration.recyclerview.RecyclerViewPreloader;
|
||||||
|
import com.bumptech.glide.util.FixedPreloadSizeProvider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.asynctasks.PostActionAsyncTask;
|
|
||||||
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
import app.fedilab.android.asynctasks.SyncBookmarksAsyncTask;
|
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||||
import app.fedilab.android.client.API;
|
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
|
import app.fedilab.android.client.Entities.Attachment;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
|
import app.fedilab.android.databinding.ActivityLiveBookmarkBinding;
|
||||||
|
import app.fedilab.android.drawers.PixelfedListAdapter;
|
||||||
import app.fedilab.android.drawers.StatusListAdapter;
|
import app.fedilab.android.drawers.StatusListAdapter;
|
||||||
|
import app.fedilab.android.fragments.DisplayStatusFragment;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveFeedsInterface;
|
import app.fedilab.android.interfaces.OnRetrieveFeedsInterface;
|
||||||
import app.fedilab.android.interfaces.OnSyncBookmarksInterface;
|
|
||||||
import app.fedilab.android.sqlite.AccountDAO;
|
import app.fedilab.android.sqlite.AccountDAO;
|
||||||
import app.fedilab.android.sqlite.Sqlite;
|
import app.fedilab.android.sqlite.Sqlite;
|
||||||
|
import es.dmoral.toasty.Toasty;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 15/11/2019.
|
* Created by Thomas on 28/01/2021.
|
||||||
* Bookmark activity
|
* Bookmark activity that are directly taken from the server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInterface, OnSyncBookmarksInterface {
|
public class LiveBookmarkActivity extends BaseActivity implements OnRetrieveFeedsInterface {
|
||||||
|
|
||||||
private List<Status> statuses;
|
private List<Status> statuses;
|
||||||
private StatusListAdapter statusListAdapter;
|
private StatusListAdapter statusListAdapter;
|
||||||
private RelativeLayout textviewNoAction;
|
private PixelfedListAdapter pixelfedListAdapter;
|
||||||
private RelativeLayout mainLoader;
|
|
||||||
private RecyclerView lv_status;
|
|
||||||
private ImageView pp_actionBar;
|
private ImageView pp_actionBar;
|
||||||
|
private ActivityLiveBookmarkBinding binding;
|
||||||
|
private boolean isSwipped, flag_loading, firstLoad;
|
||||||
|
private String max_id;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -89,16 +93,23 @@ public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInt
|
||||||
default:
|
default:
|
||||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_bookmark);
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
isSwipped = false;
|
||||||
setSupportActionBar(toolbar);
|
max_id = null;
|
||||||
|
flag_loading = true;
|
||||||
|
firstLoad = true;
|
||||||
|
|
||||||
|
binding = ActivityLiveBookmarkBinding.inflate(getLayoutInflater());
|
||||||
|
View viewRoot = binding.getRoot();
|
||||||
|
setContentView(viewRoot);
|
||||||
|
setSupportActionBar(binding.toolbar);
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
assert inflater != null;
|
assert inflater != null;
|
||||||
View view = inflater.inflate(R.layout.simple_action_bar, new LinearLayout(BookmarkActivity.this), false);
|
View view = inflater.inflate(R.layout.simple_action_bar, new LinearLayout(LiveBookmarkActivity.this), false);
|
||||||
toolbar.setBackgroundColor(ContextCompat.getColor(BookmarkActivity.this, R.color.cyanea_primary));
|
binding.toolbar.setBackgroundColor(ContextCompat.getColor(LiveBookmarkActivity.this, R.color.cyanea_primary));
|
||||||
view.setBackground(new ColorDrawable(ContextCompat.getColor(BookmarkActivity.this, R.color.cyanea_primary)));
|
view.setBackground(new ColorDrawable(ContextCompat.getColor(LiveBookmarkActivity.this, R.color.cyanea_primary)));
|
||||||
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
TextView title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
TextView title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||||
|
@ -115,16 +126,76 @@ public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInt
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||||
Account account = new AccountDAO(BookmarkActivity.this, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(LiveBookmarkActivity.this, db).getUniqAccount(userId, instance);
|
||||||
|
|
||||||
Helper.loadGiF(BookmarkActivity.this, account, pp_actionBar);
|
Helper.loadGiF(LiveBookmarkActivity.this, account, pp_actionBar);
|
||||||
|
|
||||||
lv_status = findViewById(R.id.lv_status);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
this.statuses = new ArrayList<>();
|
||||||
|
|
||||||
|
boolean isOnWifi = Helper.isOnWIFI(LiveBookmarkActivity.this);
|
||||||
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.BOOKMARKS);
|
||||||
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
|
statusDrawerParams.setStatuses(this.statuses);
|
||||||
|
|
||||||
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(statusListAdapter);
|
||||||
|
} else {
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(pixelfedListAdapter);
|
||||||
|
}
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(LiveBookmarkActivity.this);
|
||||||
|
binding.lvStatus.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
|
ListPreloader.PreloadSizeProvider sizeProvider =
|
||||||
|
new FixedPreloadSizeProvider(640, 480);
|
||||||
|
ListPreloader.PreloadModelProvider modelProvider = new MyPreloadModelProvider();
|
||||||
|
RecyclerViewPreloader preloader =
|
||||||
|
new RecyclerViewPreloader<>(Glide.with(LiveBookmarkActivity.this), modelProvider, sizeProvider, 20);
|
||||||
|
binding.lvStatus.addOnScrollListener(preloader);
|
||||||
|
|
||||||
|
binding.swipeContainer.setOnRefreshListener(() -> {
|
||||||
|
if (statuses.size() > 0) {
|
||||||
|
int size = statuses.size();
|
||||||
|
isSwipped = true;
|
||||||
|
statuses.clear();
|
||||||
|
statuses = new ArrayList<>();
|
||||||
|
max_id = null;
|
||||||
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemRangeRemoved(0, size);
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemRangeRemoved(0, size);
|
||||||
|
}
|
||||||
|
firstLoad = true;
|
||||||
|
new RetrieveFeedsAsyncTask(LiveBookmarkActivity.this, RetrieveFeedsAsyncTask.Type.BOOKMARKS, null, LiveBookmarkActivity.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.lvStatus.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||||
|
if (dy > 0) {
|
||||||
|
int visibleItemCount = mLayoutManager.getChildCount();
|
||||||
|
int totalItemCount = mLayoutManager.getItemCount();
|
||||||
|
if (firstVisibleItem + visibleItemCount == totalItemCount) {
|
||||||
|
if (!flag_loading) {
|
||||||
|
flag_loading = true;
|
||||||
|
new RetrieveFeedsAsyncTask(LiveBookmarkActivity.this, RetrieveFeedsAsyncTask.Type.BOOKMARKS, max_id, LiveBookmarkActivity.this);
|
||||||
|
binding.loadingNextStatus.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.loadingNextStatus.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new RetrieveFeedsAsyncTask(LiveBookmarkActivity.this, RetrieveFeedsAsyncTask.Type.BOOKMARKS, null, LiveBookmarkActivity.this);
|
||||||
|
|
||||||
mainLoader = findViewById(R.id.loader);
|
|
||||||
textviewNoAction = findViewById(R.id.no_action);
|
|
||||||
mainLoader.setVisibility(View.VISIBLE);
|
|
||||||
new RetrieveFeedsAsyncTask(BookmarkActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, BookmarkActivity.this);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,103 +206,113 @@ public class BookmarkActivity extends BaseActivity implements OnRetrieveFeedsInt
|
||||||
if (itemId == android.R.id.home) {
|
if (itemId == android.R.id.home) {
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_import_bookmarks) {
|
|
||||||
new SyncBookmarksAsyncTask(BookmarkActivity.this, SyncBookmarksAsyncTask.sync.IMPORT, BookmarkActivity.this);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.bookmarks, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||||
mainLoader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
FloatingActionButton delete_all = null;
|
binding.loadingNextStatus.setVisibility(View.GONE);
|
||||||
try {
|
//handle other API error but discards 404 - error which can often happen due to toots which have been deleted
|
||||||
delete_all = findViewById(R.id.delete_all);
|
if (this.statuses == null || apiResponse == null || (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404 && apiResponse.getError().getStatusCode() != 501)) {
|
||||||
} catch (Exception ignored) {
|
if (apiResponse == null)
|
||||||
}
|
Toasty.error(LiveBookmarkActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
final boolean isOnWifi = Helper.isOnWIFI(BookmarkActivity.this);
|
else {
|
||||||
statuses = apiResponse.getStatuses();
|
if (apiResponse.getError().getError().length() < 100) {
|
||||||
if (statuses != null && statuses.size() > 0) {
|
Toasty.error(LiveBookmarkActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(BookmarkActivity.this);
|
|
||||||
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
|
||||||
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS);
|
|
||||||
statusDrawerParams.setTargetedId(null);
|
|
||||||
statusDrawerParams.setOnWifi(isOnWifi);
|
|
||||||
statusDrawerParams.setStatuses(this.statuses);
|
|
||||||
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
|
||||||
lv_status.setAdapter(statusListAdapter);
|
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
|
||||||
} else {
|
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delete_all != null)
|
|
||||||
delete_all.setOnClickListener(view -> {
|
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
|
||||||
int style;
|
|
||||||
if (theme == Helper.THEME_DARK) {
|
|
||||||
style = R.style.DialogDark;
|
|
||||||
} else if (theme == Helper.THEME_BLACK) {
|
|
||||||
style = R.style.DialogBlack;
|
|
||||||
} else {
|
} else {
|
||||||
style = R.style.Dialog;
|
Toasty.error(LiveBookmarkActivity.this, getString(R.string.long_api_error, "\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(BookmarkActivity.this, style);
|
}
|
||||||
builder.setTitle(R.string.delete_all);
|
binding.swipeContainer.setRefreshing(false);
|
||||||
builder.setIcon(android.R.drawable.ic_dialog_alert)
|
flag_loading = false;
|
||||||
.setPositiveButton(R.string.yes, (dialogConfirm, which) -> {
|
return;
|
||||||
statuses = new ArrayList<>();
|
}
|
||||||
statuses.clear();
|
|
||||||
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
|
||||||
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS);
|
|
||||||
statusDrawerParams.setTargetedId(null);
|
|
||||||
statusDrawerParams.setOnWifi(isOnWifi);
|
|
||||||
statusDrawerParams.setStatuses(this.statuses);
|
|
||||||
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
|
||||||
lv_status.setAdapter(statusListAdapter);
|
|
||||||
statusListAdapter.notifyDataSetChanged();
|
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
|
||||||
new PostActionAsyncTask(BookmarkActivity.this, API.StatusAction.UNBOOKMARK);
|
|
||||||
dialogConfirm.dismiss();
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no, (dialogConfirm, which) -> dialogConfirm.dismiss())
|
|
||||||
.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
int previousPosition = this.statuses.size();
|
||||||
public void onRetrieveBookmarks(List<Status> bookmarks) {
|
List<Status> statuses;
|
||||||
if (bookmarks != null) {
|
|
||||||
statuses = new ArrayList<>();
|
if (apiResponse.getResults() != null && apiResponse.getResults().getStatuses() != null)
|
||||||
statuses.clear();
|
statuses = apiResponse.getResults().getStatuses();
|
||||||
statuses.addAll(bookmarks);
|
else
|
||||||
final boolean isOnWifi = Helper.isOnWIFI(BookmarkActivity.this);
|
statuses = apiResponse.getStatuses();
|
||||||
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
|
||||||
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS);
|
//At this point all statuses are in "List<Status> statuses"
|
||||||
statusDrawerParams.setTargetedId(null);
|
max_id = apiResponse.getMax_id();
|
||||||
statusDrawerParams.setOnWifi(isOnWifi);
|
|
||||||
statusDrawerParams.setStatuses(this.statuses);
|
//while max_id is different from null, there are some more toots to load when scrolling
|
||||||
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
flag_loading = (max_id == null);
|
||||||
lv_status.setAdapter(statusListAdapter);
|
//If it's the first load and the reply doesn't contain any toots, a message is displayed.
|
||||||
statusListAdapter.notifyDataSetChanged();
|
if (firstLoad && (statuses == null || statuses.size() == 0)) {
|
||||||
if (statuses.size() == 0) {
|
binding.noAction.setVisibility(View.VISIBLE);
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
binding.lvStatus.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
binding.lvStatus.setVisibility(View.VISIBLE);
|
||||||
|
binding.noAction.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Let's deal with statuses
|
||||||
|
if (statuses != null && statuses.size() > 0) {
|
||||||
|
this.statuses.addAll(statuses);
|
||||||
|
if (!isSwipped) {
|
||||||
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemRangeInserted(previousPosition, statuses.size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
|
||||||
|
pixelfedListAdapter.notifyItemRangeInserted(previousPosition, statuses.size());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isSwipped = false;
|
||||||
|
boolean isOnWifi = Helper.isOnWIFI(LiveBookmarkActivity.this);
|
||||||
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.BOOKMARKS);
|
||||||
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
|
statusDrawerParams.setStatuses(this.statuses);
|
||||||
|
|
||||||
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(statusListAdapter);
|
||||||
|
} else {
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(pixelfedListAdapter);
|
||||||
|
}
|
||||||
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(LiveBookmarkActivity.this);
|
||||||
|
binding.lvStatus.setLayoutManager(mLayoutManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.swipeContainer.setRefreshing(false);
|
||||||
|
firstLoad = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class MyPreloadModelProvider implements ListPreloader.PreloadModelProvider<String> {
|
||||||
|
@Override
|
||||||
|
@NonNull
|
||||||
|
public List<String> getPreloadItems(int position) {
|
||||||
|
if (statuses == null || statuses.size() == 0) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
Status status = statuses.get(position);
|
||||||
|
if (status.getMedia_attachments() == null || status.getMedia_attachments().size() == 0) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<String> preloaded_urls = new ArrayList<>();
|
||||||
|
for (Attachment attachment : status.getMedia_attachments()) {
|
||||||
|
preloaded_urls.add(attachment.getPreview_url());
|
||||||
|
}
|
||||||
|
return preloaded_urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public RequestBuilder<?> getPreloadRequestBuilder(@NonNull String url) {
|
||||||
|
return Glide.with(LiveBookmarkActivity.this)
|
||||||
|
.load(url)
|
||||||
|
.thumbnail(0.1f)
|
||||||
|
.override(640, 480);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,16 +650,14 @@ public class LoginActivity extends BaseActivity {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
connectionButton.setEnabled(true);
|
connectionButton.setEnabled(true);
|
||||||
runOnUiThread(() -> {
|
String message;
|
||||||
String message;
|
if (e.getLocalizedMessage() != null && e.getLocalizedMessage().trim().length() > 0)
|
||||||
if (e.getLocalizedMessage() != null && e.getLocalizedMessage().trim().length() > 0)
|
message = e.getLocalizedMessage();
|
||||||
message = e.getLocalizedMessage();
|
else if (e.getMessage() != null && e.getMessage().trim().length() > 0)
|
||||||
else if (e.getMessage() != null && e.getMessage().trim().length() > 0)
|
message = e.getMessage();
|
||||||
message = e.getMessage();
|
else
|
||||||
else
|
message = getString(R.string.client_error);
|
||||||
message = getString(R.string.client_error);
|
Toasty.error(LoginActivity.this, message, Toast.LENGTH_LONG).show();
|
||||||
Toasty.error(LoginActivity.this, message, Toast.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
|
@ -23,18 +23,16 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -47,6 +45,9 @@ import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Account;
|
import app.fedilab.android.client.Entities.Account;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
|
import app.fedilab.android.client.PixelfedAPI;
|
||||||
|
import app.fedilab.android.databinding.ActivityShowConversationBinding;
|
||||||
|
import app.fedilab.android.drawers.PixelfedListAdapter;
|
||||||
import app.fedilab.android.drawers.StatusListAdapter;
|
import app.fedilab.android.drawers.StatusListAdapter;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveContextInterface;
|
import app.fedilab.android.interfaces.OnRetrieveContextInterface;
|
||||||
|
@ -66,19 +67,18 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
private Status initialStatus;
|
private Status initialStatus;
|
||||||
private Status detailsStatus;
|
private Status detailsStatus;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
private RecyclerView lv_status;
|
|
||||||
private List<Status> statuses;
|
private List<Status> statuses;
|
||||||
private StatusListAdapter statusListAdapter;
|
private StatusListAdapter statusListAdapter;
|
||||||
|
private PixelfedListAdapter pixelfedListAdapter;
|
||||||
private boolean expanded;
|
private boolean expanded;
|
||||||
private BroadcastReceiver receive_action;
|
private BroadcastReceiver receive_action;
|
||||||
private String conversationId;
|
private String conversationId;
|
||||||
private boolean spoilerShown, spoilerBehaviour;
|
private boolean spoilerShown, spoilerBehaviour;
|
||||||
private LinearLayout loader;
|
private ActivityShowConversationBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
|
@ -91,8 +91,10 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
default:
|
default:
|
||||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.activity_show_conversation);
|
binding = ActivityShowConversationBinding.inflate(getLayoutInflater());
|
||||||
lv_status = findViewById(R.id.lv_status);
|
View viewRoot = binding.getRoot();
|
||||||
|
setContentView(viewRoot);
|
||||||
|
|
||||||
spoilerShown = spoilerBehaviour = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false);
|
spoilerShown = spoilerBehaviour = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false);
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
|
@ -105,8 +107,8 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
if (detailsStatus == null || detailsStatus.getId() == null)
|
if (detailsStatus == null || detailsStatus.getId() == null)
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
loader = findViewById(R.id.loader);
|
|
||||||
loader.setVisibility(View.VISIBLE);
|
binding.loader.setVisibility(View.VISIBLE);
|
||||||
detailsStatus.setFocused(true);
|
detailsStatus.setFocused(true);
|
||||||
//Some spannable
|
//Some spannable
|
||||||
Status.fillSpan(new WeakReference<>(ShowConversationActivity.this), detailsStatus);
|
Status.fillSpan(new WeakReference<>(ShowConversationActivity.this), detailsStatus);
|
||||||
|
@ -123,35 +125,30 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
Status status = b.getParcelable("status");
|
Status status = b.getParcelable("status");
|
||||||
if (status != null && statusListAdapter != null) {
|
if (status != null && statusListAdapter != null) {
|
||||||
statusListAdapter.notifyStatusChanged(status);
|
statusListAdapter.notifyStatusChanged(status);
|
||||||
|
} else if (status != null && pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
LocalBroadcastManager.getInstance(ShowConversationActivity.this).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_ACTION));
|
LocalBroadcastManager.getInstance(ShowConversationActivity.this).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_ACTION));
|
||||||
}
|
}
|
||||||
Toolbar actionBar = findViewById(R.id.toolbar);
|
|
||||||
if (actionBar != null) {
|
binding.incToolbar.toolbar.setBackground(new ColorDrawable(ContextCompat.getColor(ShowConversationActivity.this, R.color.cyanea_primary)));
|
||||||
actionBar.setBackground(new ColorDrawable(ContextCompat.getColor(ShowConversationActivity.this, R.color.cyanea_primary)));
|
binding.incToolbar.toolbarTitle.setText(R.string.conversation);
|
||||||
}
|
|
||||||
TextView title = findViewById(R.id.toolbar_title);
|
|
||||||
ImageView pp_actionBar = findViewById(R.id.pp_actionBar);
|
|
||||||
ImageView action_refresh = findViewById(R.id.action_refresh);
|
|
||||||
ImageView action_expand = findViewById(R.id.action_expand);
|
|
||||||
title.setText(R.string.conversation);
|
|
||||||
ImageView close_conversation = findViewById(R.id.close_conversation);
|
|
||||||
ImageView action_unhide = findViewById(R.id.action_unhide);
|
|
||||||
if (expanded)
|
if (expanded)
|
||||||
action_expand.setImageResource(R.drawable.ic_expand_less);
|
binding.incToolbar.actionExpand.setImageResource(R.drawable.ic_expand_less);
|
||||||
else
|
else
|
||||||
action_expand.setImageResource(R.drawable.ic_expand_more);
|
binding.incToolbar.actionExpand.setImageResource(R.drawable.ic_expand_more);
|
||||||
title.setOnClickListener(view -> {
|
//Scroll to top
|
||||||
if (lv_status != null) {
|
binding.incToolbar.toolbarTitle.setOnClickListener(view -> {
|
||||||
lv_status.setAdapter(statusListAdapter);
|
if (statusListAdapter != null) {
|
||||||
|
binding.lvStatus.setAdapter(statusListAdapter);
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
binding.lvStatus.setAdapter(pixelfedListAdapter);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (close_conversation != null) {
|
binding.incToolbar.closeConversation.setOnClickListener(v -> finish());
|
||||||
close_conversation.setOnClickListener(v -> finish());
|
binding.incToolbar.actionRefresh.setOnClickListener(view -> {
|
||||||
}
|
|
||||||
action_refresh.setOnClickListener(view -> {
|
|
||||||
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
||||||
Bundle b1 = new Bundle();
|
Bundle b1 = new Bundle();
|
||||||
b1.putParcelable("status", detailsStatus);
|
b1.putParcelable("status", detailsStatus);
|
||||||
|
@ -164,7 +161,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
});
|
});
|
||||||
|
|
||||||
action_unhide.setOnClickListener(v -> {
|
binding.incToolbar.actionUnhide.setOnClickListener(v -> {
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
spoilerShown = !spoilerShown;
|
spoilerShown = !spoilerShown;
|
||||||
for (Status status : statuses) {
|
for (Status status : statuses) {
|
||||||
|
@ -172,11 +169,15 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
status.setSpoilerShown(spoilerShown);
|
status.setSpoilerShown(spoilerShown);
|
||||||
status.setShowSpoiler(spoilerShown);
|
status.setShowSpoiler(spoilerShown);
|
||||||
}
|
}
|
||||||
statusListAdapter.notifyItemRangeChanged(0, statuses.size());
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemRangeChanged(0, statuses.size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemRangeChanged(0, statuses.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
action_expand.setOnClickListener(v -> {
|
binding.incToolbar.actionExpand.setOnClickListener(v -> {
|
||||||
expanded = !expanded;
|
expanded = !expanded;
|
||||||
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
||||||
Bundle b12 = new Bundle();
|
Bundle b12 = new Bundle();
|
||||||
|
@ -199,7 +200,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
Toasty.error(ShowConversationActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
Toasty.error(ShowConversationActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
Helper.loadGiF(ShowConversationActivity.this, account, pp_actionBar);
|
Helper.loadGiF(ShowConversationActivity.this, account, binding.incToolbar.ppActionBar);
|
||||||
|
|
||||||
|
|
||||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||||
|
@ -222,12 +223,19 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
statusDrawerParams.setOnWifi(isOnWifi);
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
statusDrawerParams.setStatuses(statuses);
|
statusDrawerParams.setStatuses(statuses);
|
||||||
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CONTEXT);
|
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CONTEXT);
|
||||||
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
|
||||||
|
|
||||||
final LinearLayoutManager mLayoutManager;
|
final LinearLayoutManager mLayoutManager;
|
||||||
mLayoutManager = new LinearLayoutManager(this);
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
binding.lvStatus.setLayoutManager(mLayoutManager);
|
||||||
lv_status.setAdapter(statusListAdapter);
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(pixelfedListAdapter);
|
||||||
|
} else {
|
||||||
|
statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
||||||
|
binding.lvStatus.setAdapter(statusListAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String statusIdToFetch = null;
|
String statusIdToFetch = null;
|
||||||
if (initialStatus != null)
|
if (initialStatus != null)
|
||||||
statusIdToFetch = initialStatus.getId();
|
statusIdToFetch = initialStatus.getId();
|
||||||
|
@ -238,7 +246,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
if (conversationId != null)
|
if (conversationId != null)
|
||||||
statusIdToFetch = conversationId;
|
statusIdToFetch = conversationId;
|
||||||
|
|
||||||
new RetrieveContextAsyncTask(ShowConversationActivity.this, expanded, detailsStatus.getVisibility().equals("direct"), statusIdToFetch, ShowConversationActivity.this);
|
new RetrieveContextAsyncTask(ShowConversationActivity.this, expanded, detailsStatus.getVisibility().equals("direct"), detailsStatus.getAccount().getId(), statusIdToFetch, ShowConversationActivity.this);
|
||||||
swipeRefreshLayout.setDistanceToTriggerSync(500);
|
swipeRefreshLayout.setDistanceToTriggerSync(500);
|
||||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||||
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
Intent intent = new Intent(ShowConversationActivity.this, ShowConversationActivity.class);
|
||||||
|
@ -254,6 +262,23 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Searching some pixelfed info (bookmarked?)
|
||||||
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
new Thread(() -> {
|
||||||
|
JSONObject result = new PixelfedAPI(ShowConversationActivity.this).getPostDetails(detailsStatus.getAccount().getUsername(), detailsStatus.getId());
|
||||||
|
if (result != null && result.has("bookmarked")) {
|
||||||
|
try {
|
||||||
|
boolean bookmarked = result.getBoolean("bookmarked");
|
||||||
|
statuses.get(0).setBookmarked(bookmarked);
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
pixelfedListAdapter.notifyItemChanged(0);
|
||||||
|
});
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +288,11 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
for (Status s : this.statuses) {
|
for (Status s : this.statuses) {
|
||||||
if (status.getIn_reply_to_id().equals(s.getId())) {
|
if (status.getIn_reply_to_id().equals(s.getId())) {
|
||||||
this.statuses.add(position + 1, status);
|
this.statuses.add(position + 1, status);
|
||||||
statusListAdapter.notifyItemInserted(position + 1);
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemInserted(position + 1);
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemInserted(position + 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
|
@ -291,7 +320,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
@Override
|
@Override
|
||||||
public void onRetrieveContext(APIResponse apiResponse) {
|
public void onRetrieveContext(APIResponse apiResponse) {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
loader.setVisibility(View.GONE);
|
binding.loader.setVisibility(View.GONE);
|
||||||
if (apiResponse.getError() != null) {
|
if (apiResponse.getError() != null) {
|
||||||
if (apiResponse.getError().getError() != null) {
|
if (apiResponse.getError().getError() != null) {
|
||||||
Toasty.error(ShowConversationActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
Toasty.error(ShowConversationActivity.this, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||||
|
@ -304,16 +333,28 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
if (BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && BaseMainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
statusListAdapter.setConversationPosition(apiResponse.getContext().getAncestors().size());
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.setConversationPosition(apiResponse.getContext().getAncestors().size());
|
||||||
|
}
|
||||||
if (!expanded) {
|
if (!expanded) {
|
||||||
if (apiResponse.getContext().getAncestors() != null && apiResponse.getContext().getAncestors().size() > 0) {
|
if (apiResponse.getContext().getAncestors() != null && apiResponse.getContext().getAncestors().size() > 0) {
|
||||||
statuses.addAll(0, apiResponse.getContext().getAncestors());
|
if (statusListAdapter != null) {
|
||||||
statusListAdapter.notifyItemRangeInserted(0, apiResponse.getContext().getAncestors().size());
|
statuses.addAll(0, apiResponse.getContext().getAncestors());
|
||||||
|
statusListAdapter.notifyItemRangeInserted(0, apiResponse.getContext().getAncestors().size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
statuses.addAll(1, apiResponse.getContext().getAncestors());
|
||||||
|
pixelfedListAdapter.notifyItemRangeInserted(1, apiResponse.getContext().getAncestors().size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int targetedPosition = statuses.size() - 1;
|
int targetedPosition = statuses.size() - 1;
|
||||||
if (apiResponse.getContext().getDescendants() != null && apiResponse.getContext().getDescendants().size() > 0) {
|
if (apiResponse.getContext().getDescendants() != null && apiResponse.getContext().getDescendants().size() > 0) {
|
||||||
statuses.addAll(apiResponse.getContext().getAncestors().size() + 1, apiResponse.getContext().getDescendants());
|
statuses.addAll(apiResponse.getContext().getAncestors().size() + 1, apiResponse.getContext().getDescendants());
|
||||||
statusListAdapter.notifyItemRangeChanged(apiResponse.getContext().getAncestors().size() + 1, apiResponse.getContext().getDescendants().size());
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemRangeChanged(apiResponse.getContext().getAncestors().size() + 1, apiResponse.getContext().getDescendants().size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemRangeChanged(apiResponse.getContext().getAncestors().size() + 1, apiResponse.getContext().getDescendants().size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
decorate(targetedPosition);
|
decorate(targetedPosition);
|
||||||
} else {
|
} else {
|
||||||
|
@ -323,15 +364,22 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
for (Status status : statusesTemp) {
|
for (Status status : statusesTemp) {
|
||||||
statuses.add(status);
|
statuses.add(status);
|
||||||
if (status.getId().equals(detailsStatus.getId())) {
|
if (status.getId().equals(detailsStatus.getId())) {
|
||||||
statusListAdapter.setConversationPosition(i);
|
|
||||||
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.setConversationPosition(i);
|
||||||
|
}
|
||||||
detailsStatus = status;
|
detailsStatus = status;
|
||||||
position = i;
|
position = i;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
decorate(position);
|
decorate(position);
|
||||||
statusListAdapter.notifyItemRangeChanged(1, apiResponse.getContext().getDescendants().size());
|
if (statusListAdapter != null) {
|
||||||
lv_status.scrollToPosition(position);
|
statusListAdapter.notifyItemRangeChanged(1, apiResponse.getContext().getDescendants().size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemRangeChanged(1, apiResponse.getContext().getDescendants().size());
|
||||||
|
}
|
||||||
|
binding.lvStatus.scrollToPosition(position);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -359,15 +407,15 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
decorate(0);
|
decorate(0);
|
||||||
final LinearLayoutManager mLayoutManager;
|
final LinearLayoutManager mLayoutManager;
|
||||||
mLayoutManager = new LinearLayoutManager(this);
|
mLayoutManager = new LinearLayoutManager(this);
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
binding.lvStatus.setLayoutManager(mLayoutManager);
|
||||||
|
|
||||||
lv_status.setAdapter(statusListAdapter);
|
binding.lvStatus.setAdapter(statusListAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Add lines and offset to messages
|
||||||
private void decorate(int targetedPosition) {
|
private void decorate(int targetedPosition) {
|
||||||
for (int i = 0; i < statuses.size(); i++) {
|
for (int i = 0; i < statuses.size(); i++) {
|
||||||
if (i == targetedPosition) {
|
if (i == targetedPosition) {
|
||||||
|
@ -384,7 +432,11 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusListAdapter.notifyItemRangeChanged(0, statuses.size());
|
if (statusListAdapter != null) {
|
||||||
|
statusListAdapter.notifyItemRangeChanged(0, statuses.size());
|
||||||
|
} else if (pixelfedListAdapter != null) {
|
||||||
|
pixelfedListAdapter.notifyItemRangeChanged(0, statuses.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,14 +56,14 @@ public class RetrieveAccountsForReplyAsyncTask {
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
API api = new API(this.contextReference.get());
|
API api = new API(this.contextReference.get());
|
||||||
app.fedilab.android.client.Entities.Context statusContext = api.getStatusContext(status.getId());
|
app.fedilab.android.client.Entities.Context statusContext = api.getStatusContext(null, status.getId());
|
||||||
addedAccounts = new ArrayList<>();
|
addedAccounts = new ArrayList<>();
|
||||||
accounts.add(status.getAccount());
|
accounts.add(status.getAccount());
|
||||||
addedAccounts.add(status.getAccount().getAcct());
|
addedAccounts.add(status.getAccount().getAcct());
|
||||||
|
|
||||||
//Retrieves the first toot
|
//Retrieves the first toot
|
||||||
if (statusContext.getAncestors().size() > 0) {
|
if (statusContext.getAncestors().size() > 0) {
|
||||||
statusContext = api.getStatusContext(statusContext.getAncestors().get(0).getId());
|
statusContext = api.getStatusContext(null, statusContext.getAncestors().get(0).getId());
|
||||||
}
|
}
|
||||||
if (statusContext != null && statusContext.getDescendants().size() > 0) {
|
if (statusContext != null && statusContext.getDescendants().size() > 0) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statusContext.getDescendants()) {
|
for (app.fedilab.android.client.Entities.Status status : statusContext.getDescendants()) {
|
||||||
|
|
|
@ -39,15 +39,17 @@ public class RetrieveContextAsyncTask {
|
||||||
private final OnRetrieveContextInterface listener;
|
private final OnRetrieveContextInterface listener;
|
||||||
private final WeakReference<Context> contextReference;
|
private final WeakReference<Context> contextReference;
|
||||||
private final boolean expanded;
|
private final boolean expanded;
|
||||||
|
private final String userId;
|
||||||
private final boolean directtimeline;
|
private final boolean directtimeline;
|
||||||
private APIResponse apiResponse;
|
private APIResponse apiResponse;
|
||||||
|
|
||||||
public RetrieveContextAsyncTask(Context context, boolean expanded, boolean directtimeline, String statusId, OnRetrieveContextInterface onRetrieveContextInterface) {
|
public RetrieveContextAsyncTask(Context context, boolean expanded, boolean directtimeline, String userId, String statusId, OnRetrieveContextInterface onRetrieveContextInterface) {
|
||||||
this.contextReference = new WeakReference<>(context);
|
this.contextReference = new WeakReference<>(context);
|
||||||
this.statusId = statusId;
|
this.statusId = statusId;
|
||||||
this.listener = onRetrieveContextInterface;
|
this.listener = onRetrieveContextInterface;
|
||||||
this.expanded = expanded;
|
this.expanded = expanded;
|
||||||
this.directtimeline = directtimeline;
|
this.directtimeline = directtimeline;
|
||||||
|
this.userId = userId;
|
||||||
doInBackground();
|
doInBackground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,10 +61,10 @@ public class RetrieveContextAsyncTask {
|
||||||
Error error;
|
Error error;
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.GNU && MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
API api = new API(this.contextReference.get());
|
API api = new API(this.contextReference.get());
|
||||||
statusContext = api.getStatusContext(statusId);
|
statusContext = api.getStatusContext(userId, statusId);
|
||||||
//Retrieves the first toot
|
//Retrieves the first toot
|
||||||
if (expanded && statusContext != null && statusContext.getAncestors() != null && statusContext.getAncestors().size() > 0) {
|
if (expanded && statusContext != null && statusContext.getAncestors() != null && statusContext.getAncestors().size() > 0) {
|
||||||
statusContext = api.getStatusContext(statusContext.getAncestors().get(0).getId());
|
statusContext = api.getStatusContext(userId, statusContext.getAncestors().get(0).getId());
|
||||||
}
|
}
|
||||||
error = api.getError();
|
error = api.getError();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import app.fedilab.android.client.Entities.Peertube;
|
||||||
import app.fedilab.android.client.Entities.RemoteInstance;
|
import app.fedilab.android.client.Entities.RemoteInstance;
|
||||||
import app.fedilab.android.client.Entities.Results;
|
import app.fedilab.android.client.Entities.Results;
|
||||||
import app.fedilab.android.client.Entities.RetrieveFeedsParam;
|
import app.fedilab.android.client.Entities.RetrieveFeedsParam;
|
||||||
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.GNUAPI;
|
import app.fedilab.android.client.GNUAPI;
|
||||||
import app.fedilab.android.client.PeertubeAPI;
|
import app.fedilab.android.client.PeertubeAPI;
|
||||||
import app.fedilab.android.helper.FilterToots;
|
import app.fedilab.android.helper.FilterToots;
|
||||||
|
@ -222,9 +223,9 @@ public class RetrieveFeedsAsyncTask {
|
||||||
if (this.social != null && this.social.equals("MASTODON")) {
|
if (this.social != null && this.social.equals("MASTODON")) {
|
||||||
apiResponse = api.getPublicTimelineTag(this.currentfilter, true, max_id, this.remoteInstance);
|
apiResponse = api.getPublicTimelineTag(this.currentfilter, true, max_id, this.remoteInstance);
|
||||||
if (apiResponse != null) {
|
if (apiResponse != null) {
|
||||||
List<app.fedilab.android.client.Entities.Status> statusesTemp = apiResponse.getStatuses();
|
List<Status> statusesTemp = apiResponse.getStatuses();
|
||||||
if (statusesTemp != null) {
|
if (statusesTemp != null) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
|
for (Status status : statusesTemp) {
|
||||||
status.setType(action);
|
status.setType(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,25 +244,25 @@ public class RetrieveFeedsAsyncTask {
|
||||||
List<RemoteInstance> remoteInstanceObj = new InstancesDAO(this.contextReference.get(), db).getInstanceByName(this.instanceName);
|
List<RemoteInstance> remoteInstanceObj = new InstancesDAO(this.contextReference.get(), db).getInstanceByName(this.instanceName);
|
||||||
if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MASTODON")) {
|
if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MASTODON")) {
|
||||||
apiResponse = api.getPublicTimeline(this.instanceName, true, max_id);
|
apiResponse = api.getPublicTimeline(this.instanceName, true, max_id);
|
||||||
List<app.fedilab.android.client.Entities.Status> statusesTemp = apiResponse.getStatuses();
|
List<Status> statusesTemp = apiResponse.getStatuses();
|
||||||
if (statusesTemp != null) {
|
if (statusesTemp != null) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
|
for (Status status : statusesTemp) {
|
||||||
status.setType(action);
|
status.setType(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MISSKEY")) {
|
} else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("MISSKEY")) {
|
||||||
apiResponse = api.getMisskey(this.instanceName, max_id);
|
apiResponse = api.getMisskey(this.instanceName, max_id);
|
||||||
List<app.fedilab.android.client.Entities.Status> statusesTemp = apiResponse.getStatuses();
|
List<Status> statusesTemp = apiResponse.getStatuses();
|
||||||
if (statusesTemp != null) {
|
if (statusesTemp != null) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
|
for (Status status : statusesTemp) {
|
||||||
status.setType(action);
|
status.setType(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("NITTER")) {
|
} else if (remoteInstanceObj != null && remoteInstanceObj.size() > 0 && remoteInstanceObj.get(0).getType().equals("NITTER")) {
|
||||||
apiResponse = api.getNitter(this.instanceName, max_id);
|
apiResponse = api.getNitter(this.instanceName, max_id);
|
||||||
List<app.fedilab.android.client.Entities.Status> statusesTemp = apiResponse.getStatuses();
|
List<Status> statusesTemp = apiResponse.getStatuses();
|
||||||
if (statusesTemp != null) {
|
if (statusesTemp != null) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statusesTemp) {
|
for (Status status : statusesTemp) {
|
||||||
status.setType(action);
|
status.setType(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,14 +327,14 @@ public class RetrieveFeedsAsyncTask {
|
||||||
tag = tag.replace("_cache_", "");
|
tag = tag.replace("_cache_", "");
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
Results results = new Results();
|
Results results = new Results();
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = new TimelineCacheDAO(contextReference.get(), db).search(tag, max_id);
|
List<Status> statuses = new TimelineCacheDAO(contextReference.get(), db).search(tag, max_id);
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
|
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
|
||||||
}
|
}
|
||||||
List<app.fedilab.android.client.Entities.Status> statusesNew = null;
|
List<Status> statusesNew = null;
|
||||||
if (statuses != null) {
|
if (statuses != null) {
|
||||||
statusesNew = new ArrayList<>();
|
statusesNew = new ArrayList<>();
|
||||||
for (app.fedilab.android.client.Entities.Status status : statuses) {
|
for (Status status : statuses) {
|
||||||
if (tag != null && !tag.contains("\"")) {
|
if (tag != null && !tag.contains("\"")) {
|
||||||
String[] searches = tag.split(" ");
|
String[] searches = tag.split(" ");
|
||||||
for (String search : searches) {
|
for (String search : searches) {
|
||||||
|
@ -372,14 +373,17 @@ public class RetrieveFeedsAsyncTask {
|
||||||
case ART:
|
case ART:
|
||||||
apiResponse = api.getArtTimeline(false, max_id, null, null, null);
|
apiResponse = api.getArtTimeline(false, max_id, null, null, null);
|
||||||
break;
|
break;
|
||||||
|
case BOOKMARKS:
|
||||||
|
apiResponse = api.getBookmarks(max_id);
|
||||||
|
break;
|
||||||
case CACHE_BOOKMARKS:
|
case CACHE_BOOKMARKS:
|
||||||
apiResponse = new APIResponse();
|
apiResponse = new APIResponse();
|
||||||
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
List<Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
if (statuses != null) {
|
if (statuses != null) {
|
||||||
|
|
||||||
for (app.fedilab.android.client.Entities.Status status : statuses) {
|
for (Status status : statuses) {
|
||||||
app.fedilab.android.client.Entities.Status.fillSpan(contextReference, status);
|
Status.fillSpan(contextReference, status);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
|
@ -397,8 +401,8 @@ public class RetrieveFeedsAsyncTask {
|
||||||
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
db = Sqlite.getInstance(contextReference.get().getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
|
statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
for (app.fedilab.android.client.Entities.Status status : statuses) {
|
for (Status status : statuses) {
|
||||||
app.fedilab.android.client.Entities.Status.fillSpan(contextReference, status);
|
Status.fillSpan(contextReference, status);
|
||||||
}
|
}
|
||||||
apiResponse.setStatuses(statuses);
|
apiResponse.setStatuses(statuses);
|
||||||
apiResponse.setSince_id(statuses.get(0).getId());
|
apiResponse.setSince_id(statuses.get(0).getId());
|
||||||
|
@ -474,8 +478,8 @@ public class RetrieveFeedsAsyncTask {
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
List<String> bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatusId(StatusCacheDAO.BOOKMARK_CACHE);
|
List<String> bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatusId(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
if (apiResponse != null && apiResponse.getStatuses() != null && bookmarks != null && apiResponse.getStatuses().size() > 0) {
|
if (apiResponse != null && apiResponse.getStatuses() != null && bookmarks != null && apiResponse.getStatuses().size() > 0) {
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = apiResponse.getStatuses();
|
List<Status> statuses = apiResponse.getStatuses();
|
||||||
for (app.fedilab.android.client.Entities.Status status : statuses) {
|
for (Status status : statuses) {
|
||||||
status.setBookmarked(bookmarks.contains(status.getId()));
|
status.setBookmarked(bookmarks.contains(status.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,6 +542,7 @@ public class RetrieveFeedsAsyncTask {
|
||||||
GNU_GROUP_TIMELINE,
|
GNU_GROUP_TIMELINE,
|
||||||
|
|
||||||
SCHEDULED_TOOTS,
|
SCHEDULED_TOOTS,
|
||||||
|
BOOKMARKS,
|
||||||
CACHE_BOOKMARKS,
|
CACHE_BOOKMARKS,
|
||||||
CACHE_BOOKMARKS_PEERTUBE,
|
CACHE_BOOKMARKS_PEERTUBE,
|
||||||
CACHE_STATUS,
|
CACHE_STATUS,
|
||||||
|
|
|
@ -83,19 +83,6 @@ public class SyncBookmarksAsyncTask {
|
||||||
}
|
}
|
||||||
} while (max_id != null);
|
} while (max_id != null);
|
||||||
statusList = new StatusCacheDAO(contextReference.get(), db).getAllStatus(BOOKMARK_CACHE);
|
statusList = new StatusCacheDAO(contextReference.get(), db).getAllStatus(BOOKMARK_CACHE);
|
||||||
} else if (type == sync.EXPORT) {
|
|
||||||
List<app.fedilab.android.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(BOOKMARK_CACHE);
|
|
||||||
if (statuses != null) {
|
|
||||||
for (app.fedilab.android.client.Entities.Status tmpStatus : statuses) {
|
|
||||||
new API(contextReference.get()).postAction(API.StatusAction.BOOKMARK, tmpStatus.getId());
|
|
||||||
try {
|
|
||||||
Thread.sleep(200);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
SystemClock.sleep(200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
statusList = new StatusCacheDAO(contextReference.get(), db).getAllStatus(BOOKMARK_CACHE);
|
|
||||||
} else {
|
} else {
|
||||||
APIResponse apiResponse = new API(contextReference.get()).getStatusbyIdAndCache(statusId);
|
APIResponse apiResponse = new API(contextReference.get()).getStatusbyIdAndCache(statusId);
|
||||||
app.fedilab.android.client.Entities.Status refreshedStatus = apiResponse.getStatuses().get(0);
|
app.fedilab.android.client.Entities.Status refreshedStatus = apiResponse.getStatuses().get(0);
|
||||||
|
@ -111,7 +98,6 @@ public class SyncBookmarksAsyncTask {
|
||||||
|
|
||||||
|
|
||||||
public enum sync {
|
public enum sync {
|
||||||
EXPORT,
|
|
||||||
IMPORT,
|
IMPORT,
|
||||||
REFRESH
|
REFRESH
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,8 +136,8 @@ public class API {
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && tootPerPage > 30) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && tootPerPage > 20) {
|
||||||
tootPerPage = 30;
|
tootPerPage = 20;
|
||||||
}
|
}
|
||||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||||
|
@ -169,8 +169,8 @@ public class API {
|
||||||
}
|
}
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
tootPerPage = sharedpreferences.getInt(Helper.SET_TOOT_PER_PAGE, Helper.TOOTS_PER_PAGE);
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && tootPerPage > 30) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && tootPerPage > 20) {
|
||||||
tootPerPage = 30;
|
tootPerPage = 20;
|
||||||
}
|
}
|
||||||
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
accountPerPage = Helper.ACCOUNTS_PER_PAGE;
|
||||||
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
notificationPerPage = Helper.NOTIFICATIONS_PER_PAGE;
|
||||||
|
@ -2834,12 +2834,11 @@ public class API {
|
||||||
params.put("max_id", max_id);
|
params.put("max_id", max_id);
|
||||||
if (since_id != null)
|
if (since_id != null)
|
||||||
params.put("since_id", since_id);
|
params.put("since_id", since_id);
|
||||||
if (0 < limit || limit > 40)
|
if (0 > limit || limit > 40)
|
||||||
limit = 40;
|
limit = 40;
|
||||||
if (pinned)
|
if (pinned)
|
||||||
params.put("pinned", Boolean.toString(true));
|
params.put("pinned", Boolean.toString(true));
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
limit = 20;
|
|
||||||
params.put("only_media", Boolean.toString(true));
|
params.put("only_media", Boolean.toString(true));
|
||||||
if (max_id == null) {
|
if (max_id == null) {
|
||||||
params.put("min_id", "1");
|
params.put("min_id", "1");
|
||||||
|
@ -2987,11 +2986,16 @@ public class API {
|
||||||
* @param statusId Id of the status
|
* @param statusId Id of the status
|
||||||
* @return List<Status>
|
* @return List<Status>
|
||||||
*/
|
*/
|
||||||
public app.fedilab.android.client.Entities.Context getStatusContext(String statusId) {
|
public app.fedilab.android.client.Entities.Context getStatusContext(String userId, String statusId) {
|
||||||
app.fedilab.android.client.Entities.Context statusContext = new app.fedilab.android.client.Entities.Context();
|
app.fedilab.android.client.Entities.Context statusContext = new app.fedilab.android.client.Entities.Context();
|
||||||
try {
|
try {
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||||
String response = httpsConnection.get(getAbsoluteUrl(String.format("/statuses/%s/context", statusId)), 10, null, prefKeyOauthTokenT);
|
String response;
|
||||||
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
response = httpsConnection.get(getAbsoluteUrl(String.format("/statuses/%s/context", statusId)), 10, null, prefKeyOauthTokenT);
|
||||||
|
} else {
|
||||||
|
response = httpsConnection.get(getAbsoluteUr2l(String.format("/comments/%s/status/%s", userId, statusId)), 10, null, prefKeyOauthTokenT);
|
||||||
|
}
|
||||||
statusContext = parseContext(new JSONObject(response));
|
statusContext = parseContext(new JSONObject(response));
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
setError(e.getStatusCode(), e);
|
setError(e.getStatusCode(), e);
|
||||||
|
@ -3332,6 +3336,10 @@ public class API {
|
||||||
apiResponse.setSince_id(statuses.get(0).getId());
|
apiResponse.setSince_id(statuses.get(0).getId());
|
||||||
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
|
apiResponse.setMax_id(statuses.get(statuses.size() - 1).getId());
|
||||||
}
|
}
|
||||||
|
if (statuses.size() < tootPerPage) {
|
||||||
|
apiResponse.setSince_id(null);
|
||||||
|
apiResponse.setMax_id(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3350,6 +3358,10 @@ public class API {
|
||||||
apiResponse.setMax_id(notifications.get(notifications.size() - 1).getId());
|
apiResponse.setMax_id(notifications.get(notifications.size() - 1).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (notifications.size() < tootPerPage) {
|
||||||
|
apiResponse.setSince_id(null);
|
||||||
|
apiResponse.setMax_id(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3366,6 +3378,10 @@ public class API {
|
||||||
apiResponse.setSince_id(accounts.get(0).getId());
|
apiResponse.setSince_id(accounts.get(0).getId());
|
||||||
apiResponse.setMax_id(accounts.get(accounts.size() - 1).getId());
|
apiResponse.setMax_id(accounts.get(accounts.size() - 1).getId());
|
||||||
}
|
}
|
||||||
|
if (accounts.size() < tootPerPage) {
|
||||||
|
apiResponse.setSince_id(null);
|
||||||
|
apiResponse.setMax_id(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4240,6 +4256,7 @@ public class API {
|
||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves bookmarked status for the authenticated account *synchronously*
|
* Retrieves bookmarked status for the authenticated account *synchronously*
|
||||||
*
|
*
|
||||||
|
@ -4250,13 +4267,21 @@ public class API {
|
||||||
public APIResponse getBookmarks(String max_id) {
|
public APIResponse getBookmarks(String max_id) {
|
||||||
|
|
||||||
HashMap<String, String> params = new HashMap<>();
|
HashMap<String, String> params = new HashMap<>();
|
||||||
if (max_id != null)
|
|
||||||
params.put("max_id", max_id);
|
|
||||||
params.put("limit", "40");
|
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
String response;
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||||
String response = httpsConnection.get(getAbsoluteUrl("/bookmarks"), 10, params, prefKeyOauthTokenT);
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
if (max_id != null)
|
||||||
|
params.put("max_id", max_id);
|
||||||
|
params.put("limit", "40");
|
||||||
|
response = httpsConnection.get(getAbsoluteUrl("/bookmarks"), 10, params, prefKeyOauthTokenT);
|
||||||
|
} else {
|
||||||
|
params.put("max_id", max_id);
|
||||||
|
params.put("limit", String.valueOf(tootPerPage));
|
||||||
|
response = httpsConnection.get(Helper.instanceWithProtocol(this.context, this.instance) + "/api/local/bookmarks", 10, params, prefKeyOauthTokenT);
|
||||||
|
}
|
||||||
|
|
||||||
statuses = parseStatuses(context, new JSONArray(response));
|
statuses = parseStatuses(context, new JSONArray(response));
|
||||||
setStatusesMaxId(httpsConnection, statuses);
|
setStatusesMaxId(httpsConnection, statuses);
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
@ -4352,7 +4377,6 @@ public class API {
|
||||||
* @return in status code - Should be equal to 200 when action is done
|
* @return in status code - Should be equal to 200 when action is done
|
||||||
*/
|
*/
|
||||||
private int postAction(StatusAction statusAction, String targetedId, Status status, String comment) {
|
private int postAction(StatusAction statusAction, String targetedId, Status status, String comment) {
|
||||||
|
|
||||||
String action;
|
String action;
|
||||||
HashMap<String, String> params = null;
|
HashMap<String, String> params = null;
|
||||||
switch (statusAction) {
|
switch (statusAction) {
|
||||||
|
@ -4375,10 +4399,22 @@ public class API {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BOOKMARK:
|
case BOOKMARK:
|
||||||
action = String.format("/statuses/%s/bookmark", targetedId);
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
action = String.format("/statuses/%s/bookmark", targetedId);
|
||||||
|
} else {
|
||||||
|
action = "/i/bookmark";
|
||||||
|
params = new HashMap<>();
|
||||||
|
params.put("item", targetedId);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UNBOOKMARK:
|
case UNBOOKMARK:
|
||||||
action = String.format("/statuses/%s/unbookmark", targetedId);
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
action = String.format("/statuses/%s/unbookmark", targetedId);
|
||||||
|
} else {
|
||||||
|
action = "/i/bookmark";
|
||||||
|
params = new HashMap<>();
|
||||||
|
params.put("item", targetedId);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case REBLOG:
|
case REBLOG:
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
|
@ -4574,6 +4610,7 @@ public class API {
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED || (statusAction != StatusAction.UNSTATUS
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED || (statusAction != StatusAction.UNSTATUS
|
||||||
&& statusAction != StatusAction.ADD_REACTION && statusAction != StatusAction.REMOVE_REACTION
|
&& statusAction != StatusAction.ADD_REACTION && statusAction != StatusAction.REMOVE_REACTION
|
||||||
&& statusAction != StatusAction.ADD_PLEROMA_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION)) {
|
&& statusAction != StatusAction.ADD_PLEROMA_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION)) {
|
||||||
|
@ -4624,6 +4661,7 @@ public class API {
|
||||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||||
httpsConnection.delete(getAbsoluteUrl(action), 10, null, prefKeyOauthTokenT);
|
httpsConnection.delete(getAbsoluteUrl(action), 10, null, prefKeyOauthTokenT);
|
||||||
actionCode = httpsConnection.getActionCode();
|
actionCode = httpsConnection.getActionCode();
|
||||||
|
//Delete a status (Mastodon or Pleroma)
|
||||||
if (statusAction != StatusAction.REMOVE_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION) {
|
if (statusAction != StatusAction.REMOVE_REACTION && statusAction != StatusAction.REMOVE_PLEROMA_REACTION) {
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
new TimelineCacheDAO(context, db).remove(targetedId);
|
new TimelineCacheDAO(context, db).remove(targetedId);
|
||||||
|
@ -4637,7 +4675,6 @@ public class API {
|
||||||
return actionCode;
|
return actionCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public int reportStatus(List<Status> statuses, String comment, boolean forward) {
|
public int reportStatus(List<Status> statuses, String comment, boolean forward) {
|
||||||
String action;
|
String action;
|
||||||
HashMap<String, String> params;
|
HashMap<String, String> params;
|
||||||
|
@ -4880,7 +4917,6 @@ public class API {
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
Status statusreturned = parseStatuses(context, new JSONObject(response));
|
Status statusreturned = parseStatuses(context, new JSONObject(response));
|
||||||
statuses.add(statusreturned);
|
statuses.add(statusreturned);
|
||||||
setStatusesMaxId(httpsConnection, statuses);
|
|
||||||
} else {
|
} else {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
@ -4889,8 +4925,8 @@ public class API {
|
||||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||||
status.setAccount(account);
|
status.setAccount(account);
|
||||||
statuses.add(status);
|
statuses.add(status);
|
||||||
setStatusesMaxId(httpsConnection, statuses);
|
|
||||||
}
|
}
|
||||||
|
setStatusesMaxId(httpsConnection, statuses);
|
||||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
setError(e.getStatusCode(), e);
|
setError(e.getStatusCode(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -6370,8 +6406,13 @@ public class API {
|
||||||
|
|
||||||
app.fedilab.android.client.Entities.Context context = new app.fedilab.android.client.Entities.Context();
|
app.fedilab.android.client.Entities.Context context = new app.fedilab.android.client.Entities.Context();
|
||||||
try {
|
try {
|
||||||
context.setAncestors(parseStatuses(this.context, jsonObject.getJSONArray("ancestors")));
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
context.setDescendants(parseStatuses(this.context, jsonObject.getJSONArray("descendants")));
|
context.setAncestors(parseStatuses(this.context, jsonObject.getJSONArray("data")));
|
||||||
|
} else {
|
||||||
|
context.setAncestors(parseStatuses(this.context, jsonObject.getJSONArray("ancestors")));
|
||||||
|
context.setDescendants(parseStatuses(this.context, jsonObject.getJSONArray("descendants")));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
setDefaultError(e);
|
setDefaultError(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class Status implements Parcelable {
|
||||||
private List<String> conversationProfilePicture;
|
private List<String> conversationProfilePicture;
|
||||||
private String webviewURL = null;
|
private String webviewURL = null;
|
||||||
|
|
||||||
private boolean isBoostAnimated = false, isFavAnimated = false;
|
private boolean isBoostAnimated = false, isFavAnimated = false, isBookmarkAnimated;
|
||||||
private String scheduled_at;
|
private String scheduled_at;
|
||||||
private String contentType;
|
private String contentType;
|
||||||
private boolean isNotice = false;
|
private boolean isNotice = false;
|
||||||
|
@ -239,6 +239,7 @@ public class Status implements Parcelable {
|
||||||
this.webviewURL = in.readString();
|
this.webviewURL = in.readString();
|
||||||
this.isBoostAnimated = in.readByte() != 0;
|
this.isBoostAnimated = in.readByte() != 0;
|
||||||
this.isFavAnimated = in.readByte() != 0;
|
this.isFavAnimated = in.readByte() != 0;
|
||||||
|
this.isBookmarkAnimated = in.readByte() != 0;
|
||||||
this.scheduled_at = in.readString();
|
this.scheduled_at = in.readString();
|
||||||
this.contentType = in.readString();
|
this.contentType = in.readString();
|
||||||
this.showSpoiler = in.readByte() != 0;
|
this.showSpoiler = in.readByte() != 0;
|
||||||
|
@ -1022,6 +1023,7 @@ public class Status implements Parcelable {
|
||||||
dest.writeString(this.webviewURL);
|
dest.writeString(this.webviewURL);
|
||||||
dest.writeByte(this.isBoostAnimated ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.isBoostAnimated ? (byte) 1 : (byte) 0);
|
||||||
dest.writeByte(this.isFavAnimated ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.isFavAnimated ? (byte) 1 : (byte) 0);
|
||||||
|
dest.writeByte(this.isBookmarkAnimated ? (byte) 1 : (byte) 0);
|
||||||
dest.writeString(this.scheduled_at);
|
dest.writeString(this.scheduled_at);
|
||||||
dest.writeString(this.contentType);
|
dest.writeString(this.contentType);
|
||||||
dest.writeByte(this.showSpoiler ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.showSpoiler ? (byte) 1 : (byte) 0);
|
||||||
|
@ -1476,6 +1478,14 @@ public class Status implements Parcelable {
|
||||||
isFavAnimated = favAnimated;
|
isFavAnimated = favAnimated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBookmarkAnimated() {
|
||||||
|
return isBookmarkAnimated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBookmarkAnimated(boolean bookmarkAnimated) {
|
||||||
|
isBookmarkAnimated = bookmarkAnimated;
|
||||||
|
}
|
||||||
|
|
||||||
public Attachment getArt_attachment() {
|
public Attachment getArt_attachment() {
|
||||||
return art_attachment;
|
return art_attachment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package app.fedilab.android.client;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
@ -197,6 +196,29 @@ public class PixelfedAPI {
|
||||||
return apiResponse;
|
return apiResponse;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves Pixelfed Own Stories *synchronously*
|
||||||
|
*
|
||||||
|
* @return APIResponse
|
||||||
|
*/
|
||||||
|
public JSONObject getPostDetails(String username, String targertedId) {
|
||||||
|
try {
|
||||||
|
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||||
|
String response = httpsConnection.get(Helper.getLiveInstanceWithProtocol(context) + String.format("/api/v2/profile/%s/status/%s/state", username, targertedId), 10, null, prefKeyOauthTokenT);
|
||||||
|
apiResponse.setSince_id(httpsConnection.getSince_id());
|
||||||
|
apiResponse.setMax_id(httpsConnection.getMax_id());
|
||||||
|
return new JSONObject(response).getJSONObject("reactions");
|
||||||
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||||
|
setError(e.getStatusCode(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves Pixelfed Own Stories *synchronously*
|
* Retrieves Pixelfed Own Stories *synchronously*
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,7 +36,6 @@ import android.widget.Button;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
|
@ -45,8 +44,6 @@ import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.cardview.widget.CardView;
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
||||||
import androidx.core.app.ActivityOptionsCompat;
|
import androidx.core.app.ActivityOptionsCompat;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
@ -62,8 +59,6 @@ import com.github.stom79.mytransl.client.Results;
|
||||||
import com.github.stom79.mytransl.translate.Translate;
|
import com.github.stom79.mytransl.translate.Translate;
|
||||||
import com.smarteist.autoimageslider.IndicatorAnimations;
|
import com.smarteist.autoimageslider.IndicatorAnimations;
|
||||||
import com.smarteist.autoimageslider.SliderAnimations;
|
import com.smarteist.autoimageslider.SliderAnimations;
|
||||||
import com.smarteist.autoimageslider.SliderView;
|
|
||||||
import com.varunest.sparkbutton.SparkButton;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -93,6 +88,9 @@ import app.fedilab.android.client.Entities.Error;
|
||||||
import app.fedilab.android.client.Entities.Notification;
|
import app.fedilab.android.client.Entities.Notification;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
|
import app.fedilab.android.databinding.DrawerEmptyBinding;
|
||||||
|
import app.fedilab.android.databinding.DrawerPixelfedBinding;
|
||||||
|
import app.fedilab.android.databinding.DrawerPixelfedCommentBinding;
|
||||||
import app.fedilab.android.helper.CrossActions;
|
import app.fedilab.android.helper.CrossActions;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.helper.MastalabAutoCompleteTextView;
|
import app.fedilab.android.helper.MastalabAutoCompleteTextView;
|
||||||
|
@ -124,23 +122,22 @@ import static app.fedilab.android.activities.BaseMainActivity.social;
|
||||||
*/
|
*/
|
||||||
public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnPostActionInterface, OnRetrieveEmojiInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveSearcAccountshInterface, OnRetrieveContextInterface, OnRetrieveFeedsInterface {
|
public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnPostActionInterface, OnRetrieveEmojiInterface, OnPostStatusActionInterface, OnRetrieveSearchInterface, OnRetrieveSearcAccountshInterface, OnRetrieveContextInterface, OnRetrieveFeedsInterface {
|
||||||
|
|
||||||
|
private static final int COMMENT_STATUS = 2;
|
||||||
private static final int DISPLAYED_STATUS = 1;
|
private static final int DISPLAYED_STATUS = 1;
|
||||||
private final int HIDDEN_STATUS = 0;
|
private final int HIDDEN_STATUS = 0;
|
||||||
private final List<Status> statuses;
|
private final List<Status> statuses;
|
||||||
private final PixelfedListAdapter pixelfedListAdapter;
|
|
||||||
private final RetrieveFeedsAsyncTask.Type type;
|
private final RetrieveFeedsAsyncTask.Type type;
|
||||||
private Context context;
|
private Context context;
|
||||||
private MastalabAutoCompleteTextView comment_content;
|
private MastalabAutoCompleteTextView comment_content;
|
||||||
private String in_reply_to_status;
|
private String in_reply_to_status;
|
||||||
private String visibility;
|
private String visibility;
|
||||||
private boolean redraft = false;
|
private final boolean redraft;
|
||||||
private Status toot;
|
private Status toot;
|
||||||
|
|
||||||
public PixelfedListAdapter(RetrieveFeedsAsyncTask.Type type, List<Status> statuses) {
|
public PixelfedListAdapter(StatusDrawerParams statusDrawerParams) {
|
||||||
super();
|
statuses = statusDrawerParams.getStatuses();
|
||||||
this.statuses = statuses;
|
type = statusDrawerParams.getType();
|
||||||
this.type = type;
|
redraft = false;
|
||||||
pixelfedListAdapter = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,6 +359,8 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
}
|
}
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && !Helper.filterToots(statuses.get(position), type, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies)) {
|
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && !Helper.filterToots(statuses.get(position), type, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies)) {
|
||||||
return HIDDEN_STATUS;
|
return HIDDEN_STATUS;
|
||||||
|
} else if (position > 0 && type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||||
|
return COMMENT_STATUS;
|
||||||
} else {
|
} else {
|
||||||
return DISPLAYED_STATUS;
|
return DISPLAYED_STATUS;
|
||||||
}
|
}
|
||||||
|
@ -371,11 +370,16 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
context = parent.getContext();
|
context = parent.getContext();
|
||||||
LayoutInflater layoutInflater = LayoutInflater.from(this.context);
|
if (viewType == DISPLAYED_STATUS) {
|
||||||
if (viewType == DISPLAYED_STATUS)
|
DrawerPixelfedBinding itemBinding = DrawerPixelfedBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
return new ViewHolderPixelfed(layoutInflater.inflate(R.layout.drawer_pixelfed, parent, false));
|
return new ViewHolderPixelfed(itemBinding);
|
||||||
else
|
} else if (viewType == COMMENT_STATUS) {
|
||||||
return new ViewHolderEmpty(layoutInflater.inflate(R.layout.drawer_empty, parent, false));
|
DrawerPixelfedCommentBinding itemBinding = DrawerPixelfedCommentBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolderPixelfedComment(itemBinding);
|
||||||
|
} else {
|
||||||
|
DrawerEmptyBinding drawerEmptyBinding = DrawerEmptyBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new ViewHolderEmpty(drawerEmptyBinding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
@ -383,32 +387,62 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
if (viewHolder.getItemViewType() != HIDDEN_STATUS) {
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
final ViewHolderPixelfed holder = (ViewHolderPixelfed) viewHolder;
|
if (viewHolder.getItemViewType() == COMMENT_STATUS) {
|
||||||
|
final ViewHolderPixelfedComment holder = (ViewHolderPixelfedComment) viewHolder;
|
||||||
final Status status = statuses.get(viewHolder.getAdapterPosition());
|
final Status status = statuses.get(viewHolder.getAdapterPosition());
|
||||||
|
|
||||||
if (status.getAccount() != null && status.getAccount().getAvatar() != null)
|
if (status.getAccount() != null && status.getAccount().getAvatar() != null)
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(status.getAccount().getAvatar())
|
.load(status.getAccount().getAvatar())
|
||||||
.apply(new RequestOptions().transform(new FitCenter(), new RoundedCorners(270)))
|
.apply(new RequestOptions().transform(new FitCenter(), new RoundedCorners(270)))
|
||||||
.into(holder.pf_pp);
|
.into(holder.binding.pfPp);
|
||||||
|
int theme_text_header_2_line = prefs.getInt("theme_text_header_2_line", -1);
|
||||||
|
if (theme_text_header_2_line == -1) {
|
||||||
|
theme_text_header_2_line = ThemeHelper.getAttColor(context, R.attr.textHeader);
|
||||||
|
}
|
||||||
|
int theme_text_color = prefs.getInt("theme_text_color", -1);
|
||||||
|
if (theme_text_color != -1) {
|
||||||
|
holder.binding.pfDescription.setTextColor(theme_text_color);
|
||||||
|
}
|
||||||
|
holder.binding.pfUsername.setTextColor(theme_text_header_2_line);
|
||||||
|
holder.binding.pfDate.setTextColor(theme_text_header_2_line);
|
||||||
|
|
||||||
|
|
||||||
|
if (status.getAccount().getDisplayNameSpan() != null && status.getAccount().getDisplayNameSpan().toString().trim().length() > 0)
|
||||||
|
holder.binding.pfUsername.setText(status.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
else
|
||||||
|
holder.binding.pfUsername.setText(status.getAccount().getUsername());
|
||||||
|
|
||||||
|
holder.binding.pfDate.setText(Helper.longDateToString(status.getCreated_at()));
|
||||||
|
holder.binding.pfDescription.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
|
} else if (viewHolder.getItemViewType() == DISPLAYED_STATUS) {
|
||||||
|
final ViewHolderPixelfed holder = (ViewHolderPixelfed) viewHolder;
|
||||||
|
final Status status = statuses.get(viewHolder.getAdapterPosition());
|
||||||
|
|
||||||
|
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||||
|
holder.binding.pfBookmark.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (status.getAccount() != null && status.getAccount().getAvatar() != null)
|
||||||
|
Glide.with(context)
|
||||||
|
.load(status.getAccount().getAvatar())
|
||||||
|
.apply(new RequestOptions().transform(new FitCenter(), new RoundedCorners(270)))
|
||||||
|
.into(holder.binding.pfPp);
|
||||||
|
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
int iconColor = prefs.getInt("theme_icons_color", -1);
|
int iconColor = prefs.getInt("theme_icons_color", -1);
|
||||||
if (iconColor == -1) {
|
if (iconColor == -1) {
|
||||||
iconColor = ThemeHelper.getAttColor(context, R.attr.iconColor);
|
iconColor = ThemeHelper.getAttColor(context, R.attr.iconColor);
|
||||||
}
|
}
|
||||||
holder.pf_likes.setTextColor(iconColor);
|
holder.binding.pfLikes.setTextColor(iconColor);
|
||||||
int statusColor = prefs.getInt("theme_statuses_color", -1);
|
int statusColor = prefs.getInt("theme_statuses_color", -1);
|
||||||
if (holder.pf_cardview != null && statusColor != -1) {
|
if (statusColor != -1) {
|
||||||
holder.pf_cardview.setCardBackgroundColor(statusColor);
|
holder.binding.pfCardview.setCardBackgroundColor(statusColor);
|
||||||
} else if (holder.pf_cardview != null) {
|
} else {
|
||||||
holder.pf_cardview.setCardBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor));
|
holder.binding.pfCardview.setCardBackgroundColor(ThemeHelper.getAttColor(context, R.attr.cardviewColor));
|
||||||
}
|
}
|
||||||
int theme_text_color = prefs.getInt("theme_text_color", -1);
|
int theme_text_color = prefs.getInt("theme_text_color", -1);
|
||||||
if (holder.pf_description != null && theme_text_color != -1) {
|
if (theme_text_color != -1) {
|
||||||
holder.pf_description.setTextColor(theme_text_color);
|
holder.binding.pfDescription.setTextColor(theme_text_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
int theme_text_header_2_line = prefs.getInt("theme_text_header_2_line", -1);
|
int theme_text_header_2_line = prefs.getInt("theme_text_header_2_line", -1);
|
||||||
|
@ -416,16 +450,16 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
theme_text_header_2_line = ThemeHelper.getAttColor(context, R.attr.textHeader);
|
theme_text_header_2_line = ThemeHelper.getAttColor(context, R.attr.textHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.pf_username.setTextColor(theme_text_header_2_line);
|
holder.binding.pfUsername.setTextColor(theme_text_header_2_line);
|
||||||
holder.pf_date.setTextColor(theme_text_header_2_line);
|
holder.binding.pfDate.setTextColor(theme_text_header_2_line);
|
||||||
if (statusColor != -1) {
|
if (statusColor != -1) {
|
||||||
holder.quick_reply_container.setBackgroundColor(statusColor);
|
holder.binding.incQuickReply.quickReplyContainer.setBackgroundColor(statusColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.quick_reply_switch_to_full.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplySwitchToFull.setVisibility(View.GONE);
|
||||||
if (status.isShortReply()) {
|
if (status.isShortReply()) {
|
||||||
holder.quick_reply_container.setVisibility(View.VISIBLE);
|
holder.binding.incQuickReply.quickReplyContainer.setVisibility(View.VISIBLE);
|
||||||
holder.pixelfed_comments.setVisibility(View.VISIBLE);
|
holder.binding.pixelfedComments.setVisibility(View.VISIBLE);
|
||||||
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
||||||
if (status.isCommentsFetched()) {
|
if (status.isCommentsFetched()) {
|
||||||
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
@ -436,29 +470,29 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
StatusListAdapter statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
StatusListAdapter statusListAdapter = new StatusListAdapter(statusDrawerParams);
|
||||||
final LinearLayoutManager mLayoutManager;
|
final LinearLayoutManager mLayoutManager;
|
||||||
mLayoutManager = new LinearLayoutManager(context);
|
mLayoutManager = new LinearLayoutManager(context);
|
||||||
holder.lv_comments.setLayoutManager(mLayoutManager);
|
holder.binding.lvComments.setLayoutManager(mLayoutManager);
|
||||||
holder.lv_comments.setAdapter(statusListAdapter);
|
holder.binding.lvComments.setAdapter(statusListAdapter);
|
||||||
mLayoutManager.scrollToPositionWithOffset(i, 0);
|
mLayoutManager.scrollToPositionWithOffset(i, 0);
|
||||||
} else {
|
} else {
|
||||||
status.setCommentsFetched(true);
|
status.setCommentsFetched(true);
|
||||||
new RetrieveContextAsyncTask(context, false, false, status.getId(), PixelfedListAdapter.this);
|
new RetrieveContextAsyncTask(context, false, false, status.getAccount().getId(), status.getId(), PixelfedListAdapter.this);
|
||||||
}
|
}
|
||||||
InputMethodManager inputMethodManager =
|
InputMethodManager inputMethodManager =
|
||||||
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
assert inputMethodManager != null;
|
assert inputMethodManager != null;
|
||||||
inputMethodManager.toggleSoftInputFromWindow(
|
inputMethodManager.toggleSoftInputFromWindow(
|
||||||
holder.quick_reply_text.getApplicationWindowToken(),
|
holder.binding.incQuickReply.quickReplyText.getApplicationWindowToken(),
|
||||||
InputMethodManager.SHOW_FORCED, 0);
|
InputMethodManager.SHOW_FORCED, 0);
|
||||||
EditText content_cw = new EditText(context);
|
EditText content_cw = new EditText(context);
|
||||||
content_cw.setText(status.getReblog() != null ? status.getReblog().getSpoiler_text() : status.getSpoiler_text());
|
content_cw.setText(status.getReblog() != null ? status.getReblog().getSpoiler_text() : status.getSpoiler_text());
|
||||||
String content = TootActivity.manageMentions(userId, status.getReblog() != null ? status.getReblog() : status);
|
String content = TootActivity.manageMentions(userId, status.getReblog() != null ? status.getReblog() : status);
|
||||||
TextWatcher textWatcher = PixelfedComposeActivity.initializeTextWatcher(context, social, holder.quick_reply_text, holder.toot_space_left, null, null, PixelfedListAdapter.this, PixelfedListAdapter.this, PixelfedListAdapter.this);
|
TextWatcher textWatcher = PixelfedComposeActivity.initializeTextWatcher(context, social, holder.binding.incQuickReply.quickReplyText, holder.binding.incQuickReply.tootSpaceLeft, null, null, PixelfedListAdapter.this, PixelfedListAdapter.this, PixelfedListAdapter.this);
|
||||||
holder.quick_reply_text.addTextChangedListener(textWatcher);
|
holder.binding.incQuickReply.quickReplyText.addTextChangedListener(textWatcher);
|
||||||
holder.quick_reply_text.setText(content);
|
holder.binding.incQuickReply.quickReplyText.setText(content);
|
||||||
comment_content = holder.quick_reply_text;
|
comment_content = holder.binding.incQuickReply.quickReplyText;
|
||||||
holder.quick_reply_text.setFocusable(true);
|
holder.binding.incQuickReply.quickReplyText.setFocusable(true);
|
||||||
holder.quick_reply_text.requestFocus();
|
holder.binding.incQuickReply.quickReplyText.requestFocus();
|
||||||
holder.quick_reply_text.setSelection(content.length()); //Put cursor at the end
|
holder.binding.incQuickReply.quickReplyText.setSelection(content.length()); //Put cursor at the end
|
||||||
int newInputType = comment_content.getInputType() & (comment_content.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
|
int newInputType = comment_content.getInputType() & (comment_content.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
|
||||||
comment_content.setInputType(newInputType);
|
comment_content.setInputType(newInputType);
|
||||||
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
in_reply_to_status = status.getReblog() != null ? status.getReblog().getId() : status.getId();
|
||||||
|
@ -507,33 +541,33 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
switch (tootVisibility) {
|
switch (tootVisibility) {
|
||||||
case 4:
|
case 4:
|
||||||
visibility = "public";
|
visibility = "public";
|
||||||
holder.quick_reply_privacy.setImageResource(R.drawable.ic_public_toot);
|
holder.binding.incQuickReply.quickReplyPrivacy.setImageResource(R.drawable.ic_public_toot);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
visibility = "unlisted";
|
visibility = "unlisted";
|
||||||
holder.quick_reply_privacy.setImageResource(R.drawable.ic_lock_open_toot);
|
holder.binding.incQuickReply.quickReplyPrivacy.setImageResource(R.drawable.ic_lock_open_toot);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
visibility = "private";
|
visibility = "private";
|
||||||
holder.quick_reply_privacy.setImageResource(R.drawable.ic_lock_outline_toot);
|
holder.binding.incQuickReply.quickReplyPrivacy.setImageResource(R.drawable.ic_lock_outline_toot);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
visibility = "direct";
|
visibility = "direct";
|
||||||
holder.quick_reply_privacy.setImageResource(R.drawable.ic_mail_outline_toot);
|
holder.binding.incQuickReply.quickReplyPrivacy.setImageResource(R.drawable.ic_mail_outline_toot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
holder.quick_reply_container.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplyContainer.setVisibility(View.GONE);
|
||||||
holder.pixelfed_comments.setVisibility(View.GONE);
|
holder.binding.pixelfedComments.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
holder.art_media_play.setVisibility(View.GONE);
|
holder.binding.artMediaPlay.setVisibility(View.GONE);
|
||||||
boolean expand_media = sharedpreferences.getBoolean(Helper.SET_EXPAND_MEDIA, false);
|
boolean expand_media = sharedpreferences.getBoolean(Helper.SET_EXPAND_MEDIA, false);
|
||||||
|
|
||||||
|
|
||||||
holder.art_media.setOnClickListener(v -> {
|
holder.binding.artMedia.setOnClickListener(v -> {
|
||||||
if (expand_media || !status.isSensitive() || status.isAttachmentShown()) {
|
if (expand_media || !status.isSensitive() || status.isAttachmentShown()) {
|
||||||
Intent intent = new Intent(context, SlideMediaActivity.class);
|
Intent intent = new Intent(context, SlideMediaActivity.class);
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
@ -543,7 +577,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
intent.putExtras(b);
|
intent.putExtras(b);
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
||||||
ActivityOptionsCompat options = ActivityOptionsCompat
|
ActivityOptionsCompat options = ActivityOptionsCompat
|
||||||
.makeSceneTransitionAnimation((Activity) context, holder.art_media, status.getMedia_attachments().get(0).getUrl());
|
.makeSceneTransitionAnimation((Activity) context, holder.binding.artMedia, status.getMedia_attachments().get(0).getUrl());
|
||||||
// start the new activity
|
// start the new activity
|
||||||
context.startActivity(intent, options.toBundle());
|
context.startActivity(intent, options.toBundle());
|
||||||
} else {
|
} else {
|
||||||
|
@ -571,16 +605,16 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
|
|
||||||
if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 1) {
|
if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 1) {
|
||||||
SliderAdapter sliderAdapter = new SliderAdapter(new WeakReference<>((Activity) context), false, status);
|
SliderAdapter sliderAdapter = new SliderAdapter(new WeakReference<>((Activity) context), false, status);
|
||||||
holder.imageSlider.setSliderAdapter(sliderAdapter);
|
holder.binding.imageSlider.setSliderAdapter(sliderAdapter);
|
||||||
holder.imageSlider.setIndicatorAnimation(IndicatorAnimations.WORM);
|
holder.binding.imageSlider.setIndicatorAnimation(IndicatorAnimations.WORM);
|
||||||
holder.imageSlider.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
|
holder.binding.imageSlider.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
|
||||||
holder.art_media.setVisibility(View.GONE);
|
holder.binding.artMedia.setVisibility(View.GONE);
|
||||||
holder.imageSlider.setVisibility(View.VISIBLE);
|
holder.binding.imageSlider.setVisibility(View.VISIBLE);
|
||||||
} else if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 0) {
|
} else if (status.getMedia_attachments() != null && status.getMedia_attachments().size() > 0) {
|
||||||
holder.art_media.setVisibility(View.VISIBLE);
|
holder.binding.artMedia.setVisibility(View.VISIBLE);
|
||||||
holder.imageSlider.setVisibility(View.GONE);
|
holder.binding.imageSlider.setVisibility(View.GONE);
|
||||||
if (status.getMedia_attachments().get(0).getType() != null && status.getMedia_attachments().get(0).getType().toLowerCase().equals("video")) {
|
if (status.getMedia_attachments().get(0).getType() != null && status.getMedia_attachments().get(0).getType().toLowerCase().equals("video")) {
|
||||||
holder.art_media_play.setVisibility(View.VISIBLE);
|
holder.binding.artMediaPlay.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
String url;
|
String url;
|
||||||
if (status.getMedia_attachments().get(0).getPreview_url() != null && status.getMedia_attachments().get(0).getPreview_url().endsWith("no-preview.png")) {
|
if (status.getMedia_attachments().get(0).getPreview_url() != null && status.getMedia_attachments().get(0).getPreview_url().endsWith("no-preview.png")) {
|
||||||
|
@ -593,19 +627,19 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(url)
|
.load(url)
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f)
|
||||||
.into(holder.art_media);
|
.into(holder.binding.artMedia);
|
||||||
} else {
|
} else {
|
||||||
Glide.with(holder.itemView.getContext())
|
Glide.with(holder.itemView.getContext())
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(url)
|
.load(url)
|
||||||
.apply(new RequestOptions().transform(new BlurTransformation(50, 3)))
|
.apply(new RequestOptions().transform(new BlurTransformation(50, 3)))
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f)
|
||||||
.into(holder.art_media);
|
.into(holder.binding.artMedia);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.pf_likes.setText(context.getResources().getQuantityString(R.plurals.likes, status.getFavourites_count(), status.getFavourites_count()));
|
holder.binding.pfLikes.setText(context.getResources().getQuantityString(R.plurals.likes, status.getFavourites_count(), status.getFavourites_count()));
|
||||||
holder.pf_pp.setOnClickListener(v -> {
|
holder.binding.pfPp.setOnClickListener(v -> {
|
||||||
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
if (MainActivity.social != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
|
||||||
CrossActions.doCrossProfile(context, status.getAccount());
|
CrossActions.doCrossProfile(context, status.getAccount());
|
||||||
} else {
|
} else {
|
||||||
|
@ -618,25 +652,25 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
holder.quick_reply_switch_to_full.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplySwitchToFull.setVisibility(View.GONE);
|
||||||
holder.toot_space_left.setVisibility(View.GONE);
|
holder.binding.incQuickReply.tootSpaceLeft.setVisibility(View.GONE);
|
||||||
holder.quick_reply_emoji.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplyEmoji.setVisibility(View.GONE);
|
||||||
holder.quick_reply_privacy.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplyPrivacy.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.quick_reply_button.setOnClickListener(view -> {
|
holder.binding.incQuickReply.quickReplyButton.setOnClickListener(view -> {
|
||||||
sendToot(status);
|
sendToot(status);
|
||||||
status.setShortReply(false);
|
status.setShortReply(false);
|
||||||
holder.quick_reply_container.setVisibility(View.GONE);
|
holder.binding.incQuickReply.quickReplyContainer.setVisibility(View.GONE);
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.hideSoftInputFromWindow(holder.quick_reply_button.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(holder.binding.incQuickReply.quickReplyButton.getWindowToken(), 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
holder.pf_description.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
holder.binding.pfDescription.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||||
holder.pf_date.setText(Helper.longDateToString(status.getCreated_at()));
|
holder.binding.pfDate.setText(Helper.longDateToString(status.getCreated_at()));
|
||||||
holder.quick_reply_text.setHint(R.string.leave_a_comment);
|
holder.binding.incQuickReply.quickReplyText.setHint(R.string.leave_a_comment);
|
||||||
holder.quick_reply_button.setText(R.string.post);
|
holder.binding.incQuickReply.quickReplyButton.setText(R.string.post);
|
||||||
holder.pf_comment.setOnClickListener(v -> {
|
holder.binding.pfComment.setOnClickListener(v -> {
|
||||||
boolean currentValue = status.isShortReply();
|
boolean currentValue = status.isShortReply();
|
||||||
for (Status s : statuses) {
|
for (Status s : statuses) {
|
||||||
if (s.isShortReply() && !s.getId().equals(status.getId())) {
|
if (s.isShortReply() && !s.getId().equals(status.getId())) {
|
||||||
|
@ -648,29 +682,21 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
if (!status.isShortReply()) {
|
if (!status.isShortReply()) {
|
||||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.hideSoftInputFromWindow(holder.quick_reply_text.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(holder.binding.incQuickReply.quickReplyText.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
final View attached = holder.status_more;
|
final View attached = holder.binding.statusMore;
|
||||||
holder.status_more.setOnClickListener(v -> {
|
holder.binding.statusMore.setOnClickListener(v -> {
|
||||||
PopupMenu popup = new PopupMenu(context, attached);
|
PopupMenu popup = new PopupMenu(context, attached);
|
||||||
final boolean isOwner = status.getReblog() != null ? status.getReblog().getAccount().getId().equals(userId) : status.getAccount().getId().equals(userId);
|
final boolean isOwner = status.getReblog() != null ? status.getReblog().getAccount().getId().equals(userId) : status.getAccount().getId().equals(userId);
|
||||||
popup.getMenuInflater()
|
popup.getMenuInflater()
|
||||||
.inflate(R.menu.option_toot, popup.getMenu());
|
.inflate(R.menu.option_pixelfed, popup.getMenu());
|
||||||
if (status.getVisibility().equals("private") || status.getVisibility().equals("direct")) {
|
if (status.getVisibility().equals("private") || status.getVisibility().equals("direct")) {
|
||||||
popup.getMenu().findItem(R.id.action_mention).setVisible(false);
|
popup.getMenu().findItem(R.id.action_mention).setVisible(false);
|
||||||
}
|
}
|
||||||
if (status.isBookmarked())
|
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_remove);
|
|
||||||
else
|
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_add);
|
|
||||||
if (status.isMuted())
|
|
||||||
popup.getMenu().findItem(R.id.action_mute_conversation).setTitle(R.string.unmute_conversation);
|
|
||||||
else
|
|
||||||
popup.getMenu().findItem(R.id.action_mute_conversation).setTitle(R.string.mute_conversation);
|
|
||||||
|
|
||||||
|
|
||||||
final String[] stringArrayConf;
|
final String[] stringArrayConf;
|
||||||
|
@ -679,37 +705,12 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
if (isOwner) {
|
if (isOwner) {
|
||||||
popup.getMenu().findItem(R.id.action_block).setVisible(false);
|
popup.getMenu().findItem(R.id.action_block).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_report).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_timed_mute).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
|
||||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||||
if (social != UpdateAccountInfoAsyncTask.SOCIAL.MASTODON && social != UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
|
||||||
popup.getMenu().findItem(R.id.action_stats).setVisible(false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
popup.getMenu().findItem(R.id.action_stats).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_redraft).setVisible(false);
|
|
||||||
//popup.getMenu().findItem(R.id.action_mute_conversation).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
||||||
//Same instance
|
//Same instance
|
||||||
if (status.getAccount().getAcct().split("@").length < 2) {
|
|
||||||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
|
||||||
} else { //Both accounts have an instance in acct (pixelfed fix)
|
|
||||||
String instanceAccount = status.getAccount().getAcct().split("@")[1];
|
|
||||||
if (Helper.getLiveInstance(context).compareTo(instanceAccount) == 0) {
|
|
||||||
popup.getMenu().findItem(R.id.action_block_domain).setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
||||||
}
|
}
|
||||||
//TODO: fix and display that feature
|
|
||||||
popup.getMenu().findItem(R.id.action_admin).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_custom_sharing).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_mention).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_copy).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_stats).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_translate).setVisible(false);
|
|
||||||
popup.getMenu().findItem(R.id.action_redraft).setVisible(false);
|
|
||||||
|
|
||||||
final SharedPreferences sharedpreferences1 = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
final SharedPreferences sharedpreferences1 = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
int theme = sharedpreferences1.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences1.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
|
@ -722,30 +723,11 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
style = R.style.Dialog;
|
style = R.style.Dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean custom_sharing = sharedpreferences1.getBoolean(Helper.SET_CUSTOM_SHARING, false);
|
|
||||||
if (custom_sharing && status.getVisibility().equals("public"))
|
|
||||||
popup.getMenu().findItem(R.id.action_custom_sharing).setVisible(true);
|
|
||||||
if (status.isBookmarked())
|
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_remove);
|
|
||||||
else
|
|
||||||
popup.getMenu().findItem(R.id.action_bookmark).setTitle(R.string.bookmark_add);
|
|
||||||
popup.setOnMenuItemClickListener(item -> {
|
popup.setOnMenuItemClickListener(item -> {
|
||||||
AlertDialog.Builder builderInner;
|
AlertDialog.Builder builderInner;
|
||||||
final API.StatusAction doAction;
|
final API.StatusAction doAction;
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
if (itemId == R.id.action_redraft) {
|
if (itemId == R.id.action_info) {
|
||||||
builderInner = new AlertDialog.Builder(context, style);
|
|
||||||
builderInner.setTitle(stringArrayConf[1]);
|
|
||||||
redraft = true;
|
|
||||||
doAction = API.StatusAction.UNSTATUS;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
|
||||||
else
|
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
|
||||||
} else if (itemId == R.id.action_schedule_boost) {
|
|
||||||
scheduleBoost(status);
|
|
||||||
return true;
|
|
||||||
} else if (itemId == R.id.action_info) {
|
|
||||||
tootInformation(status);
|
tootInformation(status);
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_open_browser) {
|
} else if (itemId == R.id.action_open_browser) {
|
||||||
|
@ -759,60 +741,11 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||||
} else if (itemId == R.id.action_block_domain) {
|
|
||||||
builderInner = new AlertDialog.Builder(context, style);
|
|
||||||
builderInner.setTitle(stringArrayConf[3]);
|
|
||||||
doAction = API.StatusAction.BLOCK_DOMAIN;
|
|
||||||
String domain = status.getAccount().getAcct().split("@")[1];
|
|
||||||
builderInner.setMessage(context.getString(R.string.block_domain_confirm_message, domain));
|
|
||||||
} else if (itemId == R.id.action_mute) {
|
} else if (itemId == R.id.action_mute) {
|
||||||
builderInner = new AlertDialog.Builder(context, style);
|
builderInner = new AlertDialog.Builder(context, style);
|
||||||
builderInner.setTitle(stringArrayConf[0]);
|
builderInner.setTitle(stringArrayConf[0]);
|
||||||
builderInner.setMessage(status.getAccount().getAcct());
|
builderInner.setMessage(status.getAccount().getAcct());
|
||||||
doAction = API.StatusAction.MUTE;
|
doAction = API.StatusAction.MUTE;
|
||||||
} else if (itemId == R.id.action_mute_conversation) {
|
|
||||||
if (status.isMuted())
|
|
||||||
doAction = API.StatusAction.UNMUTE_CONVERSATION;
|
|
||||||
else
|
|
||||||
doAction = API.StatusAction.MUTE_CONVERSATION;
|
|
||||||
|
|
||||||
new PostActionAsyncTask(context, doAction, status.getId(), PixelfedListAdapter.this);
|
|
||||||
return true;
|
|
||||||
} else if (itemId == R.id.action_bookmark) {
|
|
||||||
if (type != RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS) {
|
|
||||||
status.setBookmarked(!status.isBookmarked());
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
try {
|
|
||||||
if (status.isBookmarked()) {
|
|
||||||
new StatusCacheDAO(context, db).insertStatus(StatusCacheDAO.BOOKMARK_CACHE, status);
|
|
||||||
Toasty.success(context, context.getString(R.string.status_bookmarked), Toast.LENGTH_LONG).show();
|
|
||||||
} else {
|
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, status);
|
|
||||||
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
notifyStatusChanged(status);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
int position = 0;
|
|
||||||
for (Status statustmp : statuses) {
|
|
||||||
if (statustmp.getId().equals(status.getId())) {
|
|
||||||
statuses.remove(status);
|
|
||||||
pixelfedListAdapter.notifyItemRemoved(position);
|
|
||||||
final SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.BOOKMARK_CACHE, statustmp);
|
|
||||||
Toasty.success(context, context.getString(R.string.status_unbookmarked), Toast.LENGTH_LONG).show();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else if (itemId == R.id.action_timed_mute) {
|
|
||||||
timedMuteAction(status);
|
|
||||||
return true;
|
|
||||||
} else if (itemId == R.id.action_block) {
|
} else if (itemId == R.id.action_block) {
|
||||||
builderInner = new AlertDialog.Builder(context, style);
|
builderInner = new AlertDialog.Builder(context, style);
|
||||||
builderInner.setTitle(stringArrayConf[1]);
|
builderInner.setTitle(stringArrayConf[1]);
|
||||||
|
@ -824,14 +757,6 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
else
|
else
|
||||||
translateToot(status);
|
translateToot(status);
|
||||||
return true;
|
return true;
|
||||||
} else if (itemId == R.id.action_report) {
|
|
||||||
builderInner = new AlertDialog.Builder(context, style);
|
|
||||||
builderInner.setTitle(stringArrayConf[2]);
|
|
||||||
doAction = API.StatusAction.REPORT;
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
|
||||||
else
|
|
||||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
|
||||||
} else if (itemId == R.id.action_copy_link) {
|
} else if (itemId == R.id.action_copy_link) {
|
||||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
|
||||||
|
@ -883,18 +808,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Text for report
|
|
||||||
EditText input = null;
|
|
||||||
if (doAction == API.StatusAction.REPORT) {
|
|
||||||
input = new EditText(context);
|
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
input.setLayoutParams(lp);
|
|
||||||
builderInner.setView(input);
|
|
||||||
}
|
|
||||||
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
final EditText finalInput = input;
|
|
||||||
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
|
||||||
if (doAction == API.StatusAction.UNSTATUS) {
|
if (doAction == API.StatusAction.UNSTATUS) {
|
||||||
String targetedId = status.getId();
|
String targetedId = status.getId();
|
||||||
|
@ -938,11 +852,6 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
context.startActivity(intentToot);
|
context.startActivity(intentToot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (doAction == API.StatusAction.REPORT) {
|
|
||||||
String comment = null;
|
|
||||||
if (finalInput.getText() != null)
|
|
||||||
comment = finalInput.getText().toString();
|
|
||||||
new PostActionAsyncTask(context, doAction, status.getId(), status, comment, PixelfedListAdapter.this);
|
|
||||||
} else {
|
} else {
|
||||||
String targetedId;
|
String targetedId;
|
||||||
if (item.getItemId() == R.id.action_block_domain) {
|
if (item.getItemId() == R.id.action_block_domain) {
|
||||||
|
@ -960,87 +869,190 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
popup.show();
|
popup.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
holder.binding.pfCardview.setOnClickListener(view -> {
|
||||||
holder.pf_date.setOnClickListener(view -> {
|
//For Pixelfed conversations can't be open several times
|
||||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
if (type != RetrieveFeedsAsyncTask.Type.CONTEXT) {
|
||||||
Bundle b = new Bundle();
|
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||||
if (status.getReblog() == null)
|
Bundle b = new Bundle();
|
||||||
b.putParcelable("status", status);
|
if (status.getReblog() == null)
|
||||||
else
|
b.putParcelable("status", status);
|
||||||
b.putParcelable("status", status.getReblog());
|
else
|
||||||
intent.putExtras(b);
|
b.putParcelable("status", status.getReblog());
|
||||||
context.startActivity(intent);
|
intent.putExtras(b);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (status.getAccount().getDisplayNameSpan() != null && status.getAccount().getDisplayNameSpan().toString().trim().length() > 0)
|
if (status.getAccount().getDisplayNameSpan() != null && status.getAccount().getDisplayNameSpan().toString().trim().length() > 0)
|
||||||
holder.pf_username.setText(status.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
holder.binding.pfUsername.setText(status.getAccount().getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||||
else
|
else
|
||||||
holder.pf_username.setText(status.getAccount().getUsername());
|
holder.binding.pfUsername.setText(status.getAccount().getUsername());
|
||||||
|
|
||||||
holder.pf_fav.setInActiveImageTintColor(iconColor);
|
holder.binding.pfFav.setInActiveImageTintColor(iconColor);
|
||||||
holder.pf_share.setInActiveImageTintColor(iconColor);
|
holder.binding.pfShare.setInActiveImageTintColor(iconColor);
|
||||||
Helper.changeDrawableColor(context, holder.pf_comment, iconColor);
|
holder.binding.pfBookmark.setInActiveImageTintColor(iconColor);
|
||||||
Helper.changeDrawableColor(context, holder.status_more, iconColor);
|
|
||||||
|
Helper.changeDrawableColor(context, holder.binding.pfComment, iconColor);
|
||||||
|
Helper.changeDrawableColor(context, holder.binding.statusMore, iconColor);
|
||||||
Helper.changeDrawableColor(context, R.drawable.ic_pixelfed_favorite_border, iconColor);
|
Helper.changeDrawableColor(context, R.drawable.ic_pixelfed_favorite_border, iconColor);
|
||||||
|
|
||||||
|
|
||||||
holder.pf_fav.pressOnTouch(false);
|
holder.binding.pfFav.pressOnTouch(false);
|
||||||
holder.pf_fav.setActiveImage(R.drawable.ic_pixelfed_favorite);
|
holder.binding.pfFav.setActiveImage(R.drawable.ic_pixelfed_favorite);
|
||||||
holder.pf_fav.setInactiveImage(R.drawable.ic_pixelfed_favorite_border);
|
holder.binding.pfFav.setInactiveImage(R.drawable.ic_pixelfed_favorite_border);
|
||||||
holder.pf_fav.setDisableCircle(true);
|
holder.binding.pfFav.setDisableCircle(true);
|
||||||
holder.pf_fav.setActiveImageTint(R.color.pixelfed_like);
|
holder.binding.pfFav.setActiveImageTint(R.color.pixelfed_like);
|
||||||
holder.pf_fav.setColors(R.color.pixelfed_like, R.color.pixelfed_like);
|
holder.binding.pfFav.setColors(R.color.pixelfed_like, R.color.pixelfed_like);
|
||||||
|
|
||||||
holder.pf_share.pressOnTouch(false);
|
holder.binding.pfShare.pressOnTouch(false);
|
||||||
holder.pf_share.setActiveImage(R.drawable.ic_repeat_boost);
|
holder.binding.pfShare.setActiveImage(R.drawable.ic_repeat_boost);
|
||||||
holder.pf_share.setInactiveImage(R.drawable.ic_repeat_boost);
|
holder.binding.pfShare.setInactiveImage(R.drawable.ic_repeat_boost);
|
||||||
holder.pf_share.setDisableCircle(true);
|
holder.binding.pfShare.setDisableCircle(true);
|
||||||
holder.pf_share.setActiveImageTint(R.color.boost_icon);
|
holder.binding.pfShare.setActiveImageTint(R.color.boost_icon);
|
||||||
holder.pf_share.setColors(R.color.boost_icon, R.color.boost_icon);
|
holder.binding.pfShare.setColors(R.color.boost_icon, R.color.boost_icon);
|
||||||
|
|
||||||
|
|
||||||
|
holder.binding.pfBookmark.pressOnTouch(false);
|
||||||
|
holder.binding.pfBookmark.setActiveImage(R.drawable.ic_bookmark_white_full);
|
||||||
|
holder.binding.pfBookmark.setInactiveImage(R.drawable.ic_bookmark_white);
|
||||||
|
holder.binding.pfBookmark.setDisableCircle(true);
|
||||||
|
holder.binding.pfBookmark.setActiveImageTint(R.color.marked_icon);
|
||||||
|
holder.binding.pfBookmark.setColors(R.color.marked_icon, R.color.marked_icon);
|
||||||
|
|
||||||
if (!status.isFavAnimated()) {
|
if (!status.isFavAnimated()) {
|
||||||
holder.pf_fav.setChecked(status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited()));
|
holder.binding.pfFav.setChecked(status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited()));
|
||||||
} else {
|
} else {
|
||||||
status.setFavAnimated(false);
|
status.setFavAnimated(false);
|
||||||
holder.pf_fav.setChecked(true);
|
holder.binding.pfFav.setChecked(true);
|
||||||
holder.pf_fav.setAnimationSpeed(1.0f);
|
holder.binding.pfFav.setAnimationSpeed(1.0f);
|
||||||
holder.pf_fav.playAnimation();
|
holder.binding.pfFav.playAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!status.isBoostAnimated()) {
|
if (!status.isBoostAnimated()) {
|
||||||
holder.pf_share.setChecked(status.isReblogged() || (status.getReblog() != null && status.getReblog().isReblogged()));
|
holder.binding.pfShare.setChecked(status.isReblogged() || (status.getReblog() != null && status.getReblog().isReblogged()));
|
||||||
} else {
|
} else {
|
||||||
status.setBoostAnimated(false);
|
status.setBoostAnimated(false);
|
||||||
holder.pf_share.setChecked(true);
|
holder.binding.pfShare.setChecked(true);
|
||||||
holder.pf_share.setAnimationSpeed(1.0f);
|
holder.binding.pfShare.setAnimationSpeed(1.0f);
|
||||||
holder.pf_share.playAnimation();
|
holder.binding.pfShare.playAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!status.isBookmarkAnimated()) {
|
||||||
|
holder.binding.pfBookmark.setChecked(status.isBookmarked() || (status.getReblog() != null && status.getReblog().isBookmarked()));
|
||||||
|
} else {
|
||||||
|
status.setBookmarkAnimated(false);
|
||||||
|
holder.binding.pfBookmark.setChecked(true);
|
||||||
|
holder.binding.pfBookmark.setAnimationSpeed(1.0f);
|
||||||
|
holder.binding.pfBookmark.playAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
boolean confirmFav = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION_FAV, false);
|
||||||
holder.pf_fav.setOnClickListener(v -> {
|
holder.binding.pfFav.setOnClickListener(v -> {
|
||||||
if (!status.isFavourited() && confirmFav)
|
if (!status.isFavourited() && confirmFav)
|
||||||
status.setFavAnimated(true);
|
status.setFavAnimated(true);
|
||||||
if (!status.isFavourited() && !confirmFav) {
|
if (!status.isFavourited() && !confirmFav) {
|
||||||
status.setFavAnimated(true);
|
status.setFavAnimated(true);
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
CrossActions.doCrossAction(context, type, status, null, (status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) ? API.StatusAction.UNFAVOURITE : API.StatusAction.FAVOURITE, pixelfedListAdapter, PixelfedListAdapter.this, true);
|
CrossActions.doCrossAction(context, type, status, null, (status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) ? API.StatusAction.UNFAVOURITE : API.StatusAction.FAVOURITE, this, PixelfedListAdapter.this, true);
|
||||||
});
|
});
|
||||||
boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, false);
|
boolean confirmBoost = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, false);
|
||||||
holder.pf_share.setOnClickListener(v -> {
|
holder.binding.pfShare.setOnClickListener(v -> {
|
||||||
if (!status.isReblogged() && confirmBoost)
|
if (!status.isReblogged() && confirmBoost)
|
||||||
status.setBoostAnimated(true);
|
status.setBoostAnimated(true);
|
||||||
if (!status.isReblogged() && !confirmBoost) {
|
if (!status.isReblogged() && !confirmBoost) {
|
||||||
status.setBoostAnimated(true);
|
status.setBoostAnimated(true);
|
||||||
notifyStatusChanged(status);
|
notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
CrossActions.doCrossAction(context, type, status, null, (status.isReblogged() || (status.getReblog() != null && status.getReblog().isReblogged())) ? API.StatusAction.UNREBLOG : API.StatusAction.REBLOG, pixelfedListAdapter, PixelfedListAdapter.this, true);
|
CrossActions.doCrossAction(context, type, status, null, (status.isReblogged() || (status.getReblog() != null && status.getReblog().isReblogged())) ? API.StatusAction.UNREBLOG : API.StatusAction.REBLOG, this, PixelfedListAdapter.this, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.binding.pfBookmark.setOnClickListener(v -> {
|
||||||
|
if (!status.isBookmarked()) {
|
||||||
|
status.setBookmarkAnimated(true);
|
||||||
|
notifyStatusChanged(status);
|
||||||
|
}
|
||||||
|
CrossActions.doCrossAction(context, type, status, null, (status.isBookmarked() || (status.getReblog() != null && status.getReblog().isBookmarked())) ? API.StatusAction.UNBOOKMARK : API.StatusAction.BOOKMARK, this, PixelfedListAdapter.this, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPostAction(int statusCode, API.StatusAction statusAction, String targetedId, Error error) {
|
||||||
|
|
||||||
|
if (error != null) {
|
||||||
|
Toasty.error(context, error.getError(), Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Helper.manageMessageStatusCode(context, statusCode, statusAction);
|
||||||
|
//When muting or blocking an account, its status are removed from the list
|
||||||
|
List<Status> statusesToRemove = new ArrayList<>();
|
||||||
|
if (statusAction == API.StatusAction.MUTE || statusAction == API.StatusAction.BLOCK) {
|
||||||
|
for (Status status : statuses) {
|
||||||
|
if (status.getAccount().getId().equals(targetedId))
|
||||||
|
statusesToRemove.add(status);
|
||||||
|
}
|
||||||
|
statuses.removeAll(statusesToRemove);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
} else if (statusAction == API.StatusAction.UNSTATUS) {
|
||||||
|
int position = 0;
|
||||||
|
for (Status status : statuses) {
|
||||||
|
if (status.getId().equals(targetedId)) {
|
||||||
|
statuses.remove(status);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
|
//Remove the status from cache also
|
||||||
|
try {
|
||||||
|
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
} else if (statusAction == API.StatusAction.PIN || statusAction == API.StatusAction.UNPIN) {
|
||||||
|
int position = 0;
|
||||||
|
for (Status status : statuses) {
|
||||||
|
if (status.getId().equals(targetedId)) {
|
||||||
|
status.setPinned(statusAction == API.StatusAction.PIN);
|
||||||
|
notifyItemChanged(position);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void send_delete_statuses(String targetedId) {
|
||||||
|
//Delete in the current timeline
|
||||||
|
List<Status> statusesToRemove = new ArrayList<>();
|
||||||
|
for (Status status : statuses) {
|
||||||
|
if (status.getAccount().getId().equals(targetedId))
|
||||||
|
statusesToRemove.add(status);
|
||||||
|
}
|
||||||
|
statuses.removeAll(statusesToRemove);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
//Send an intent to delete in every timelines
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putString("receive_action", targetedId);
|
||||||
|
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
||||||
|
intentBC.putExtras(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notifyStatusChanged(Status status) {
|
||||||
|
for (int i = 0; i < getItemCount(); i++) {
|
||||||
|
if (getItemAt(i) != null && getItemAt(i).getId().equals(status.getId())) {
|
||||||
|
try {
|
||||||
|
notifyItemChanged(i);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void translateToot(Status status) {
|
private void translateToot(Status status) {
|
||||||
//Manages translations
|
//Manages translations
|
||||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
@ -1146,49 +1158,12 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
static class ViewHolderEmpty extends RecyclerView.ViewHolder {
|
||||||
public void onPostAction(int statusCode, API.StatusAction statusAction, String targetedId, Error error) {
|
DrawerEmptyBinding binding;
|
||||||
|
|
||||||
if (error != null) {
|
ViewHolderEmpty(DrawerEmptyBinding itemView) {
|
||||||
Toasty.error(context, error.getError(), Toast.LENGTH_LONG).show();
|
super(itemView.getRoot());
|
||||||
return;
|
binding = itemView;
|
||||||
}
|
|
||||||
Helper.manageMessageStatusCode(context, statusCode, statusAction);
|
|
||||||
//When muting or blocking an account, its status are removed from the list
|
|
||||||
List<Status> statusesToRemove = new ArrayList<>();
|
|
||||||
if (statusAction == API.StatusAction.MUTE || statusAction == API.StatusAction.BLOCK) {
|
|
||||||
for (Status status : statuses) {
|
|
||||||
if (status.getAccount().getId().equals(targetedId))
|
|
||||||
statusesToRemove.add(status);
|
|
||||||
}
|
|
||||||
statuses.removeAll(statusesToRemove);
|
|
||||||
pixelfedListAdapter.notifyDataSetChanged();
|
|
||||||
} else if (statusAction == API.StatusAction.UNSTATUS) {
|
|
||||||
int position = 0;
|
|
||||||
for (Status status : statuses) {
|
|
||||||
if (status.getId().equals(targetedId)) {
|
|
||||||
statuses.remove(status);
|
|
||||||
pixelfedListAdapter.notifyItemRemoved(position);
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(context.getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
|
||||||
//Remove the status from cache also
|
|
||||||
try {
|
|
||||||
new StatusCacheDAO(context, db).remove(StatusCacheDAO.ARCHIVE_CACHE, status);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
} else if (statusAction == API.StatusAction.PIN || statusAction == API.StatusAction.UNPIN) {
|
|
||||||
int position = 0;
|
|
||||||
for (Status status : statuses) {
|
|
||||||
if (status.getId().equals(targetedId)) {
|
|
||||||
status.setPinned(statusAction == API.StatusAction.PIN);
|
|
||||||
pixelfedListAdapter.notifyItemChanged(position);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,20 +1247,13 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send_delete_statuses(String targetedId) {
|
static class ViewHolderPixelfed extends RecyclerView.ViewHolder {
|
||||||
//Delete in the current timeline
|
DrawerPixelfedBinding binding;
|
||||||
List<Status> statusesToRemove = new ArrayList<>();
|
|
||||||
for (Status status : statuses) {
|
ViewHolderPixelfed(DrawerPixelfedBinding itemView) {
|
||||||
if (status.getAccount().getId().equals(targetedId))
|
super(itemView.getRoot());
|
||||||
statusesToRemove.add(status);
|
binding = itemView;
|
||||||
}
|
}
|
||||||
statuses.removeAll(statusesToRemove);
|
|
||||||
pixelfedListAdapter.notifyDataSetChanged();
|
|
||||||
//Send an intent to delete in every timelines
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putString("receive_action", targetedId);
|
|
||||||
Intent intentBC = new Intent(Helper.RECEIVE_ACTION);
|
|
||||||
intentBC.putExtras(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleBoost(Status status) {
|
private void scheduleBoost(Status status) {
|
||||||
|
@ -1359,15 +1327,12 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
alertDialogBoost.show();
|
alertDialogBoost.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyStatusChanged(Status status) {
|
static class ViewHolderPixelfedComment extends RecyclerView.ViewHolder {
|
||||||
for (int i = 0; i < pixelfedListAdapter.getItemCount(); i++) {
|
DrawerPixelfedCommentBinding binding;
|
||||||
//noinspection ConstantConditions
|
|
||||||
if (pixelfedListAdapter.getItemAt(i) != null && pixelfedListAdapter.getItemAt(i).getId().equals(status.getId())) {
|
ViewHolderPixelfedComment(DrawerPixelfedCommentBinding itemView) {
|
||||||
try {
|
super(itemView.getRoot());
|
||||||
pixelfedListAdapter.notifyItemChanged(i);
|
binding = itemView;
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,56 +1359,4 @@ public class PixelfedListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ViewHolderEmpty extends RecyclerView.ViewHolder {
|
|
||||||
ViewHolderEmpty(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ViewHolderPixelfed extends RecyclerView.ViewHolder {
|
|
||||||
SliderView imageSlider;
|
|
||||||
ImageView art_media, art_media_play, pf_pp, pf_comment;
|
|
||||||
SparkButton pf_fav, pf_share;
|
|
||||||
TextView pf_username, pf_likes, pf_description, pf_date;
|
|
||||||
CardView pf_cardview;
|
|
||||||
LinearLayout pf_bottom_container;
|
|
||||||
LinearLayout pixelfed_comments;
|
|
||||||
RecyclerView lv_comments;
|
|
||||||
|
|
||||||
ConstraintLayout quick_reply_container;
|
|
||||||
MastalabAutoCompleteTextView quick_reply_text;
|
|
||||||
ImageView quick_reply_switch_to_full, status_more;
|
|
||||||
TextView toot_space_left;
|
|
||||||
ImageView quick_reply_emoji;
|
|
||||||
Button quick_reply_button;
|
|
||||||
ImageView quick_reply_privacy;
|
|
||||||
|
|
||||||
ViewHolderPixelfed(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
art_media = itemView.findViewById(R.id.art_media);
|
|
||||||
art_media_play = itemView.findViewById(R.id.art_media_play);
|
|
||||||
imageSlider = itemView.findViewById(R.id.imageSlider);
|
|
||||||
pf_pp = itemView.findViewById(R.id.pf_pp);
|
|
||||||
pf_username = itemView.findViewById(R.id.pf_username);
|
|
||||||
pf_likes = itemView.findViewById(R.id.pf_likes);
|
|
||||||
pf_description = itemView.findViewById(R.id.pf_description);
|
|
||||||
pf_date = itemView.findViewById(R.id.pf_date);
|
|
||||||
pf_fav = itemView.findViewById(R.id.pf_fav);
|
|
||||||
pf_comment = itemView.findViewById(R.id.pf_comment);
|
|
||||||
pf_share = itemView.findViewById(R.id.pf_share);
|
|
||||||
pf_cardview = itemView.findViewById(R.id.pf_cardview);
|
|
||||||
pf_bottom_container = itemView.findViewById(R.id.pf_bottom_container);
|
|
||||||
pixelfed_comments = itemView.findViewById(R.id.pixelfed_comments);
|
|
||||||
lv_comments = itemView.findViewById(R.id.lv_comments);
|
|
||||||
quick_reply_container = itemView.findViewById(R.id.quick_reply_container);
|
|
||||||
status_more = itemView.findViewById(R.id.status_more);
|
|
||||||
quick_reply_text = itemView.findViewById(R.id.quick_reply_text);
|
|
||||||
quick_reply_switch_to_full = itemView.findViewById(R.id.quick_reply_switch_to_full);
|
|
||||||
toot_space_left = itemView.findViewById(R.id.toot_space_left);
|
|
||||||
quick_reply_emoji = itemView.findViewById(R.id.quick_reply_emoji);
|
|
||||||
quick_reply_button = itemView.findViewById(R.id.quick_reply_button);
|
|
||||||
quick_reply_privacy = itemView.findViewById(R.id.quick_reply_privacy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@ import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
|
@ -2325,7 +2325,6 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
||||||
SwitchCompat nav_blocked = rootView.findViewById(R.id.nav_blocked);
|
SwitchCompat nav_blocked = rootView.findViewById(R.id.nav_blocked);
|
||||||
SwitchCompat nav_muted = rootView.findViewById(R.id.nav_muted);
|
SwitchCompat nav_muted = rootView.findViewById(R.id.nav_muted);
|
||||||
SwitchCompat nav_blocked_domains = rootView.findViewById(R.id.nav_blocked_domains);
|
SwitchCompat nav_blocked_domains = rootView.findViewById(R.id.nav_blocked_domains);
|
||||||
SwitchCompat nav_how_to = rootView.findViewById(R.id.nav_how_to);
|
|
||||||
Button validate = rootView.findViewById(R.id.validate);
|
Button validate = rootView.findViewById(R.id.validate);
|
||||||
|
|
||||||
MainMenuItem mainMenu = new MainMenuDAO(context, db).getMainMenu();
|
MainMenuItem mainMenu = new MainMenuDAO(context, db).getMainMenu();
|
||||||
|
@ -2344,7 +2343,6 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
||||||
nav_blocked.setChecked(mainMenu.isNav_blocked());
|
nav_blocked.setChecked(mainMenu.isNav_blocked());
|
||||||
nav_muted.setChecked(mainMenu.isNav_muted());
|
nav_muted.setChecked(mainMenu.isNav_muted());
|
||||||
nav_blocked_domains.setChecked(mainMenu.isNav_blocked_domains());
|
nav_blocked_domains.setChecked(mainMenu.isNav_blocked_domains());
|
||||||
nav_how_to.setChecked(mainMenu.isNav_howto());
|
|
||||||
|
|
||||||
|
|
||||||
validate.setOnClickListener(view -> {
|
validate.setOnClickListener(view -> {
|
||||||
|
@ -2361,7 +2359,6 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
||||||
mainMenuItem.setNav_blocked(nav_blocked.isChecked());
|
mainMenuItem.setNav_blocked(nav_blocked.isChecked());
|
||||||
mainMenuItem.setNav_muted(nav_muted.isChecked());
|
mainMenuItem.setNav_muted(nav_muted.isChecked());
|
||||||
mainMenuItem.setNav_blocked_domains(nav_blocked_domains.isChecked());
|
mainMenuItem.setNav_blocked_domains(nav_blocked_domains.isChecked());
|
||||||
mainMenuItem.setNav_howto(nav_how_to.isChecked());
|
|
||||||
MainMenuItem mainMenuItem1 = new MainMenuDAO(context, db).getMainMenu();
|
MainMenuItem mainMenuItem1 = new MainMenuDAO(context, db).getMainMenu();
|
||||||
|
|
||||||
if (mainMenuItem1 != null) {
|
if (mainMenuItem1 != null) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ import app.fedilab.android.activities.MainActivity;
|
||||||
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||||
import app.fedilab.android.client.APIResponse;
|
import app.fedilab.android.client.APIResponse;
|
||||||
import app.fedilab.android.client.Entities.Status;
|
import app.fedilab.android.client.Entities.Status;
|
||||||
|
import app.fedilab.android.client.Entities.StatusDrawerParams;
|
||||||
import app.fedilab.android.drawers.PixelfedListAdapter;
|
import app.fedilab.android.drawers.PixelfedListAdapter;
|
||||||
import app.fedilab.android.helper.Helper;
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.interfaces.OnRetrieveFeedsInterface;
|
import app.fedilab.android.interfaces.OnRetrieveFeedsInterface;
|
||||||
|
@ -108,7 +109,11 @@ public class DisplayBookmarksPixelfedFragment extends Fragment implements OnRetr
|
||||||
statuses = apiResponse.getStatuses();
|
statuses = apiResponse.getStatuses();
|
||||||
if (statuses != null && statuses.size() > 0) {
|
if (statuses != null && statuses.size() > 0) {
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
|
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
|
||||||
pixelfedListAdapter = new PixelfedListAdapter(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, this.statuses);
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
|
statusDrawerParams.setStatuses(this.statuses);
|
||||||
|
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS);
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
lv_status.setAdapter(pixelfedListAdapter);
|
lv_status.setAdapter(pixelfedListAdapter);
|
||||||
lv_status.setLayoutManager(mLayoutManager);
|
lv_status.setLayoutManager(mLayoutManager);
|
||||||
} else {
|
} else {
|
||||||
|
@ -138,7 +143,11 @@ public class DisplayBookmarksPixelfedFragment extends Fragment implements OnRetr
|
||||||
new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
statuses.clear();
|
statuses.clear();
|
||||||
pixelfedListAdapter = new PixelfedListAdapter(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, statuses);
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
|
statusDrawerParams.setStatuses(statuses);
|
||||||
|
statusDrawerParams.setType(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS);
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
lv_status.setAdapter(pixelfedListAdapter);
|
lv_status.setAdapter(pixelfedListAdapter);
|
||||||
pixelfedListAdapter.notifyDataSetChanged();
|
pixelfedListAdapter.notifyDataSetChanged();
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -269,7 +269,11 @@ public class DisplayStatusFragment extends Fragment implements OnPostActionInter
|
||||||
} else if (instanceType.equals("PIXELFED")) {
|
} else if (instanceType.equals("PIXELFED")) {
|
||||||
if (remoteInstance != null && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) //if it's a Peertube account connected
|
if (remoteInstance != null && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) //if it's a Peertube account connected
|
||||||
remoteInstance = instance;
|
remoteInstance = instance;
|
||||||
pixelfedListAdapter = new PixelfedListAdapter(type, this.statuses);
|
StatusDrawerParams statusDrawerParams = new StatusDrawerParams();
|
||||||
|
statusDrawerParams.setOnWifi(isOnWifi);
|
||||||
|
statusDrawerParams.setStatuses(this.statuses);
|
||||||
|
statusDrawerParams.setType(type);
|
||||||
|
pixelfedListAdapter = new PixelfedListAdapter(statusDrawerParams);
|
||||||
lv_status.setAdapter(pixelfedListAdapter);
|
lv_status.setAdapter(pixelfedListAdapter);
|
||||||
} else if (instanceType.equals("ART")) {
|
} else if (instanceType.equals("ART")) {
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
if (type == RetrieveFeedsAsyncTask.Type.TAG) {
|
||||||
|
|
|
@ -1451,6 +1451,16 @@ public class BaseHelper {
|
||||||
MenuItem itemPCom = menu.findItem(R.id.nav_peertube_comm);
|
MenuItem itemPCom = menu.findItem(R.id.nav_peertube_comm);
|
||||||
if (itemPCom != null)
|
if (itemPCom != null)
|
||||||
itemPCom.setVisible(false);
|
itemPCom.setVisible(false);
|
||||||
|
MenuItem nav_scheduled = menu.findItem(R.id.nav_scheduled);
|
||||||
|
if (nav_scheduled != null)
|
||||||
|
nav_scheduled.setVisible(false);
|
||||||
|
if (nav_scheduled != null)
|
||||||
|
nav_scheduled.setVisible(false);
|
||||||
|
MenuItem nav_blocked_domains = menu.findItem(R.id.nav_blocked_domains);
|
||||||
|
if (nav_blocked_domains != null)
|
||||||
|
nav_blocked_domains.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
} else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
} else if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||||
MenuItem itemCom = menu.findItem(R.id.nav_peertube_comm);
|
MenuItem itemCom = menu.findItem(R.id.nav_peertube_comm);
|
||||||
if (itemCom != null)
|
if (itemCom != null)
|
||||||
|
@ -1523,9 +1533,6 @@ public class BaseHelper {
|
||||||
if (!mainMenuItem.isNav_how_to_follow()) {
|
if (!mainMenuItem.isNav_how_to_follow()) {
|
||||||
menu.findItem(R.id.nav_who_to_follow).setVisible(false);
|
menu.findItem(R.id.nav_who_to_follow).setVisible(false);
|
||||||
}
|
}
|
||||||
if (!mainMenuItem.isNav_howto()) {
|
|
||||||
menu.findItem(R.id.nav_how_to).setVisible(false);
|
|
||||||
}
|
|
||||||
if (!mainMenuItem.isNav_muted()) {
|
if (!mainMenuItem.isNav_muted()) {
|
||||||
menu.findItem(R.id.nav_muted).setVisible(false);
|
menu.findItem(R.id.nav_muted).setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -1567,7 +1574,6 @@ public class BaseHelper {
|
||||||
menu.findItem(R.id.nav_archive).setVisible(false);
|
menu.findItem(R.id.nav_archive).setVisible(false);
|
||||||
menu.findItem(R.id.nav_archive_notifications).setVisible(false);
|
menu.findItem(R.id.nav_archive_notifications).setVisible(false);
|
||||||
menu.findItem(R.id.nav_who_to_follow).setVisible(false);
|
menu.findItem(R.id.nav_who_to_follow).setVisible(false);
|
||||||
menu.findItem(R.id.nav_how_to).setVisible(false);
|
|
||||||
menu.findItem(R.id.nav_partnership).setVisible(false);
|
menu.findItem(R.id.nav_partnership).setVisible(false);
|
||||||
menu.findItem(R.id.nav_news).setVisible(false);
|
menu.findItem(R.id.nav_news).setVisible(false);
|
||||||
menu.findItem(R.id.nav_trends).setVisible(false);
|
menu.findItem(R.id.nav_trends).setVisible(false);
|
||||||
|
|
|
@ -178,6 +178,18 @@ public class CrossActions {
|
||||||
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
else if (baseAdapter instanceof StatusListAdapter)
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
} else if (doAction == API.StatusAction.BOOKMARK || doAction == API.StatusAction.UNBOOKMARK) {
|
||||||
|
if (doAction == API.StatusAction.BOOKMARK) {
|
||||||
|
status.setBookmarked(true);
|
||||||
|
status.setBookmarkAnimated(true);
|
||||||
|
} else {
|
||||||
|
status.setBookmarked(false);
|
||||||
|
status.setBookmarkAnimated(false);
|
||||||
|
}
|
||||||
|
if (baseAdapter instanceof PixelfedListAdapter)
|
||||||
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (accounts.size() == 1 || undoAction) {
|
} else if (accounts.size() == 1 || undoAction) {
|
||||||
|
@ -190,6 +202,8 @@ public class CrossActions {
|
||||||
favouriteAction(context, status, onPostActionInterface);
|
favouriteAction(context, status, onPostActionInterface);
|
||||||
else if (doAction == API.StatusAction.PIN || doAction == API.StatusAction.UNPIN)
|
else if (doAction == API.StatusAction.PIN || doAction == API.StatusAction.UNPIN)
|
||||||
pinAction(context, status, baseAdapter, onPostActionInterface);
|
pinAction(context, status, baseAdapter, onPostActionInterface);
|
||||||
|
else if (doAction == API.StatusAction.BOOKMARK || doAction == API.StatusAction.UNBOOKMARK)
|
||||||
|
bookmarkAction(context, status, onPostActionInterface);
|
||||||
|
|
||||||
if (doAction == API.StatusAction.FAVOURITE || doAction == API.StatusAction.UNFAVOURITE) {
|
if (doAction == API.StatusAction.FAVOURITE || doAction == API.StatusAction.UNFAVOURITE) {
|
||||||
if (doAction == API.StatusAction.FAVOURITE) {
|
if (doAction == API.StatusAction.FAVOURITE) {
|
||||||
|
@ -215,6 +229,18 @@ public class CrossActions {
|
||||||
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
else if (baseAdapter instanceof StatusListAdapter)
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
} else if (doAction == API.StatusAction.BOOKMARK || doAction == API.StatusAction.UNBOOKMARK) {
|
||||||
|
if (doAction == API.StatusAction.BOOKMARK) {
|
||||||
|
status.setBookmarked(true);
|
||||||
|
status.setBookmarkAnimated(true);
|
||||||
|
} else {
|
||||||
|
status.setBookmarked(false);
|
||||||
|
status.setBookmarkAnimated(false);
|
||||||
|
}
|
||||||
|
if (baseAdapter instanceof PixelfedListAdapter)
|
||||||
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,6 +276,10 @@ public class CrossActions {
|
||||||
status.setFavourited(true);
|
status.setFavourited(true);
|
||||||
if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE || type == RetrieveFeedsAsyncTask.Type.NEWS)
|
if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE || type == RetrieveFeedsAsyncTask.Type.NEWS)
|
||||||
status.setFavAnimated(true);
|
status.setFavAnimated(true);
|
||||||
|
} else if (doAction == API.StatusAction.BOOKMARK) {
|
||||||
|
status.setBookmarked(true);
|
||||||
|
if (type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE || type == RetrieveFeedsAsyncTask.Type.NEWS)
|
||||||
|
status.setBookmarkAnimated(true);
|
||||||
} else if (doAction == API.StatusAction.PIN) {
|
} else if (doAction == API.StatusAction.PIN) {
|
||||||
status.setPinned(true);
|
status.setPinned(true);
|
||||||
}
|
}
|
||||||
|
@ -747,6 +777,8 @@ public class CrossActions {
|
||||||
favouriteAction(context, status, onPostActionInterface);
|
favouriteAction(context, status, onPostActionInterface);
|
||||||
else if (action == API.StatusAction.PIN || action == API.StatusAction.UNPIN)
|
else if (action == API.StatusAction.PIN || action == API.StatusAction.UNPIN)
|
||||||
pinAction(context, status, baseAdapter, onPostActionInterface);
|
pinAction(context, status, baseAdapter, onPostActionInterface);
|
||||||
|
else if (action == API.StatusAction.BOOKMARK || action == API.StatusAction.UNBOOKMARK)
|
||||||
|
bookmarkAction(context, status, onPostActionInterface);
|
||||||
|
|
||||||
if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE || action == API.StatusAction.UNFAVOURITE) {
|
||||||
if (action == API.StatusAction.FAVOURITE) {
|
if (action == API.StatusAction.FAVOURITE) {
|
||||||
|
@ -772,6 +804,18 @@ public class CrossActions {
|
||||||
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
else if (baseAdapter instanceof StatusListAdapter)
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
} else if (action == API.StatusAction.BOOKMARK || action == API.StatusAction.UNBOOKMARK) {
|
||||||
|
if (action == API.StatusAction.BOOKMARK) {
|
||||||
|
status.setBookmarked(true);
|
||||||
|
status.setBookmarkAnimated(true);
|
||||||
|
} else {
|
||||||
|
status.setBookmarked(false);
|
||||||
|
status.setBookmarkAnimated(false);
|
||||||
|
}
|
||||||
|
if (baseAdapter instanceof PixelfedListAdapter)
|
||||||
|
((PixelfedListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
|
else if (baseAdapter instanceof StatusListAdapter)
|
||||||
|
((StatusListAdapter) baseAdapter).notifyStatusChanged(status);
|
||||||
}
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
})
|
})
|
||||||
|
@ -860,6 +904,22 @@ public class CrossActions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bookmark/Unbookmark a status
|
||||||
|
*
|
||||||
|
* @param status Status
|
||||||
|
*/
|
||||||
|
private static void bookmarkAction(Context context, Status status, OnPostActionInterface onPostActionInterface) {
|
||||||
|
|
||||||
|
if (status.isFavourited() || (status.getReblog() != null && status.getReblog().isFavourited())) {
|
||||||
|
new PostActionAsyncTask(context, API.StatusAction.UNBOOKMARK, status.getId(), onPostActionInterface);
|
||||||
|
status.setBookmarked(false);
|
||||||
|
} else {
|
||||||
|
new PostActionAsyncTask(context, API.StatusAction.BOOKMARK, status.getId(), onPostActionInterface);
|
||||||
|
status.setBookmarked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reblog/Unreblog a status
|
* Reblog/Unreblog a status
|
||||||
*
|
*
|
||||||
|
|
|
@ -89,17 +89,6 @@
|
||||||
android:text="PayPal"
|
android:text="PayPal"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/about_wiki"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:autoLink="web"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/how_to_videos"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/about_website"
|
android:id="@+id/about_website"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
Copyright 2017 Thomas Schneider
|
Copyright 2021 Thomas Schneider
|
||||||
|
|
||||||
This file is a part of Fedilab
|
This file is a part of Fedilab
|
||||||
|
|
||||||
|
@ -47,12 +47,23 @@
|
||||||
android:paddingRight="@dimen/fab_margin"
|
android:paddingRight="@dimen/fab_margin"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context="app.fedilab.android.activities.BookmarkActivity">
|
tools:context="app.fedilab.android.activities.BookmarkActivity">
|
||||||
<!-- Listview status -->
|
<!-- Listview bookmark -->
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<FrameLayout
|
||||||
android:id="@+id/lv_status"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:scrollbars="none" />
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/swipeContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scrollbars="none" />
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/no_action"
|
android:id="@+id/no_action"
|
||||||
|
@ -61,12 +72,13 @@
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/no_action_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/bookmarks_empty"
|
android:text="@string/no_status"
|
||||||
android:textSize="25sp"
|
android:textSize="25sp"
|
||||||
android:textStyle="italic|bold"
|
android:textStyle="italic|bold"
|
||||||
android:typeface="serif" />
|
android:typeface="serif" />
|
||||||
|
@ -84,17 +96,21 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:indeterminate="true" />
|
android:indeterminate="true" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
<!-- Loader for next status -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/loading_next_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
android:gravity="bottom|center_horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<ProgressBar
|
||||||
android:id="@+id/delete_all"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:indeterminate="true" />
|
||||||
android:layout_gravity="bottom|end"
|
</RelativeLayout>
|
||||||
android:layout_margin="@dimen/fab_margin_floating"
|
</RelativeLayout>
|
||||||
android:contentDescription="@string/delete_all"
|
|
||||||
android:src="@drawable/ic_delete_floating"
|
|
||||||
app:backgroundTint="?colorAccent"
|
|
||||||
app:tint="?iconColorMenu" />
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -17,11 +17,13 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<include layout="@layout/conversation_action_bar" />
|
<include
|
||||||
|
android:id="@+id/inc_toolbar"
|
||||||
|
layout="@layout/conversation_action_bar" />
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<!-- Framelayout to display Fragments -->
|
<!-- Framelayout to display Fragments -->
|
||||||
<RelativeLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/main_app_container"
|
android:id="@+id/main_app_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -30,7 +32,21 @@
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context="app.fedilab.android.activities.ShowConversationActivity">
|
tools:context="app.fedilab.android.activities.ShowConversationActivity">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lv_pixelfed"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="@null"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/lv_pixelfed"
|
||||||
android:id="@+id/swipeContainer"
|
android:id="@+id/swipeContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
@ -44,6 +60,9 @@
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/swipeContainer"
|
||||||
android:id="@+id/loader"
|
android:id="@+id/loader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -64,7 +83,7 @@
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
android:text="@string/fetch_conversation" />
|
android:text="@string/fetch_conversation" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
|
@ -101,87 +101,109 @@
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
android:paddingBottom="5dp">
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
<LinearLayout
|
<com.varunest.sparkbutton.SparkButton
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/pf_fav"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:contentDescription="@string/favourite"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:sparkbutton_activeImage="@drawable/ic_pixelfed_favorite"
|
||||||
|
app:sparkbutton_iconSize="30dp"
|
||||||
|
app:sparkbutton_inActiveImage="@drawable/ic_pixelfed_favorite_border" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pf_likes"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:layout_marginTop="5dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/pf_fav" />
|
||||||
|
|
||||||
<com.varunest.sparkbutton.SparkButton
|
<ImageView
|
||||||
android:id="@+id/pf_fav"
|
android:id="@+id/pf_comment"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:contentDescription="@string/favourite"
|
android:layout_marginStart="15dp"
|
||||||
app:sparkbutton_activeImage="@drawable/ic_pixelfed_favorite"
|
android:contentDescription="@string/leave_a_comment"
|
||||||
app:sparkbutton_iconSize="30dp"
|
android:src="@drawable/ic_pixelfed_comment"
|
||||||
app:sparkbutton_inActiveImage="@drawable/ic_pixelfed_favorite_border" />
|
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/pf_fav"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:tint="?attr/iconColor" />
|
||||||
|
|
||||||
<ImageView
|
<com.varunest.sparkbutton.SparkButton
|
||||||
android:id="@+id/pf_comment"
|
android:id="@+id/pf_share"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:contentDescription="@string/leave_a_comment"
|
android:contentDescription="@string/share"
|
||||||
android:src="@drawable/ic_pixelfed_comment"
|
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
||||||
android:tint="?attr/iconColor" />
|
app:layout_constraintStart_toEndOf="@+id/pf_comment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:sparkbutton_activeImage="@drawable/ic_repeat_boost"
|
||||||
|
app:sparkbutton_iconSize="30dp"
|
||||||
|
app:sparkbutton_inActiveImage="@drawable/ic_repeat" />
|
||||||
|
|
||||||
<com.varunest.sparkbutton.SparkButton
|
|
||||||
android:id="@+id/pf_share"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:contentDescription="@string/share"
|
|
||||||
app:sparkbutton_activeImage="@drawable/ic_repeat_boost"
|
|
||||||
app:sparkbutton_iconSize="30dp"
|
|
||||||
app:sparkbutton_inActiveImage="@drawable/ic_repeat" />
|
|
||||||
|
|
||||||
<ImageView
|
<com.varunest.sparkbutton.SparkButton
|
||||||
android:id="@+id/status_more"
|
android:id="@+id/pf_bookmark"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginStart="15dp"
|
android:contentDescription="@string/bookmark_add"
|
||||||
android:contentDescription="@string/display_toot_truncate"
|
android:visibility="gone"
|
||||||
android:src="@drawable/ic_more_pixelfed"
|
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
||||||
android:tint="?attr/iconColor" />
|
app:layout_constraintStart_toEndOf="@+id/pf_share"
|
||||||
</LinearLayout>
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:sparkbutton_activeImage="@drawable/ic_bookmark_white"
|
||||||
|
app:sparkbutton_iconSize="30dp"
|
||||||
|
app:sparkbutton_inActiveImage="@drawable/ic_bookmark_white_full" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/pf_bottom_container"
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/status_more"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:contentDescription="@string/display_toot_truncate"
|
||||||
|
android:src="@drawable/ic_more_pixelfed"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:tint="?attr/iconColor" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pf_description"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_marginTop="5dp"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/pf_likes" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/pf_likes"
|
android:id="@+id/pf_date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:textStyle="bold" />
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
<TextView
|
app:layout_constraintTop_toBottomOf="@+id/pf_description" />
|
||||||
android:id="@+id/pf_description"
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textIsSelectable="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/pf_date"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/pixelfed_comments"
|
android:id="@+id/pixelfed_comments"
|
||||||
|
@ -196,6 +218,7 @@
|
||||||
android:scrollbars="none" />
|
android:scrollbars="none" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
android:id="@+id/inc_quick_reply"
|
||||||
layout="@layout/layout_quick_reply"
|
layout="@layout/layout_quick_reply"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
Copyright 2019 Thomas Schneider
|
Copyright 2021 Thomas Schneider
|
||||||
|
|
||||||
This file is a part of Fedilab
|
This file is a part of Fedilab
|
||||||
|
|
||||||
|
@ -14,217 +14,55 @@
|
||||||
You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
see <http://www.gnu.org/licenses>.
|
see <http://www.gnu.org/licenses>.
|
||||||
-->
|
-->
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/pf_cardview"
|
android:id="@+id/pf_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="20dp">
|
android:layout_marginBottom="5dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingTop="5dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
tools:ignore="UseCompoundDrawables">
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/pf_pp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:contentDescription="@string/profile_picture" />
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingTop="5dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:paddingBottom="10dp"
|
|
||||||
tools:ignore="UseCompoundDrawables">
|
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/pf_pp"
|
android:id="@+id/pf_username"
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:contentDescription="@string/profile_picture" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/pf_username"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:ignore="RtlHardcoded" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.smarteist.autoimageslider.SliderView
|
|
||||||
android:id="@+id/imageSlider"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="300dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:sliderAnimationDuration="1000"
|
|
||||||
app:sliderAutoCycleDirection="back_and_forth"
|
|
||||||
app:sliderAutoCycleEnabled="true"
|
|
||||||
app:sliderCircularHandlerEnabled="true"
|
|
||||||
app:sliderIndicatorAnimationDuration="600"
|
|
||||||
app:sliderIndicatorGravity="center_horizontal|bottom"
|
|
||||||
app:sliderIndicatorMargin="15dp"
|
|
||||||
app:sliderIndicatorOrientation="horizontal"
|
|
||||||
app:sliderIndicatorPadding="3dp"
|
|
||||||
app:sliderIndicatorRadius="2dp"
|
|
||||||
app:sliderIndicatorSelectedColor="#5A5A5A"
|
|
||||||
app:sliderIndicatorUnselectedColor="#FFF"
|
|
||||||
app:sliderScrollTimeInSec="1"
|
|
||||||
app:sliderStartAutoCycle="false" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/art_media"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/art_media_play"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:contentDescription="@string/play_video"
|
|
||||||
android:src="@drawable/ic_play_arrow"
|
|
||||||
android:visibility="gone" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:layout_marginStart="15dp"
|
||||||
android:paddingLeft="10dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:paddingTop="10dp"
|
android:textSize="16sp"
|
||||||
android:paddingRight="10dp"
|
android:textStyle="bold"
|
||||||
android:paddingBottom="5dp">
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
<com.varunest.sparkbutton.SparkButton
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:id="@+id/pf_fav"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:contentDescription="@string/favourite"
|
|
||||||
app:sparkbutton_activeImage="@drawable/ic_pixelfed_favorite"
|
|
||||||
app:sparkbutton_iconSize="30dp"
|
|
||||||
app:sparkbutton_inActiveImage="@drawable/ic_pixelfed_favorite_border" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pf_fav"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:id="@+id/pf_likes"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/pf_fav"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
|
||||||
android:id="@+id/pf_comment"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:contentDescription="@string/leave_a_comment"
|
|
||||||
android:src="@drawable/ic_pixelfed_comment"
|
|
||||||
app:tint="?attr/iconColor" />
|
|
||||||
|
|
||||||
<com.varunest.sparkbutton.SparkButton
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/pf_comment"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
|
||||||
android:id="@+id/pf_share"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:contentDescription="@string/share"
|
|
||||||
app:sparkbutton_activeImage="@drawable/ic_repeat_boost"
|
|
||||||
app:sparkbutton_iconSize="30dp"
|
|
||||||
app:sparkbutton_inActiveImage="@drawable/ic_repeat" />
|
|
||||||
|
|
||||||
|
|
||||||
<com.varunest.sparkbutton.SparkButton
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/pf_share"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
|
||||||
android:id="@+id/pf_bookmark"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:contentDescription="@string/bookmark_add"
|
|
||||||
app:sparkbutton_activeImage="@drawable/ic_bookmark_white"
|
|
||||||
app:sparkbutton_iconSize="30dp"
|
|
||||||
app:sparkbutton_inActiveImage="@drawable/ic_bookmark_white_full" />
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/pf_fav"
|
|
||||||
android:id="@+id/status_more"
|
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:layout_gravity="end|center_vertical"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:contentDescription="@string/display_toot_truncate"
|
|
||||||
android:src="@drawable/ic_more_pixelfed"
|
|
||||||
app:tint="?attr/iconColor" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pf_likes"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:id="@+id/pf_description"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textIsSelectable="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/pf_description"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:id="@+id/pf_date"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/pixelfed_comments"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/lv_comments"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:scrollbars="none" />
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/inc_quick_reply"
|
|
||||||
layout="@layout/layout_quick_reply"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
<TextView
|
||||||
|
android:id="@+id/pf_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textIsSelectable="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pf_date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -403,28 +403,6 @@
|
||||||
android:background="?colorAccent" />
|
android:background="?colorAccent" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/settings_option_margin"
|
|
||||||
android:layout_marginBottom="@dimen/settings_option_margin"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/how_to_videos"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
|
||||||
android:id="@+id/nav_how_to"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -132,22 +132,10 @@
|
||||||
android:id="@+id/nav_favorites_px"
|
android:id="@+id/nav_favorites_px"
|
||||||
android:icon="@drawable/ic_star_menu"
|
android:icon="@drawable/ic_star_menu"
|
||||||
android:title="@string/favorites_menu" />
|
android:title="@string/favorites_menu" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_pixelfed_scheduled"
|
|
||||||
android:icon="@drawable/ic_schedule"
|
|
||||||
android:title="@string/scheduled_toots" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_pixelfed_drafts"
|
|
||||||
android:icon="@drawable/ic_save_white"
|
|
||||||
android:title="@string/drafts" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_pixelfed_bookmarks"
|
android:id="@+id/nav_pixelfed_bookmarks"
|
||||||
android:icon="@drawable/ic_bookmark_menu"
|
android:icon="@drawable/ic_bookmark_menu"
|
||||||
android:title="@string/bookmarks" />
|
android:title="@string/bookmarks" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_pixelfed_blocked"
|
|
||||||
android:icon="@drawable/ic_block"
|
|
||||||
android:title="@string/blocked_menu" />
|
|
||||||
</group>
|
</group>
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
@ -183,10 +171,6 @@
|
||||||
android:icon="@drawable/ic_liberapay"
|
android:icon="@drawable/ic_liberapay"
|
||||||
android:title="Liberapay"
|
android:title="Liberapay"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_how_to"
|
|
||||||
android:icon="@drawable/ic_videocam"
|
|
||||||
android:title="@string/how_to_videos" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_about"
|
android:id="@+id/nav_about"
|
||||||
android:icon="@drawable/ic_info"
|
android:icon="@drawable/ic_info"
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item
|
|
||||||
android:id="@+id/action_export_bookmarks"
|
|
||||||
android:icon="@drawable/ic_export_bookmarks"
|
|
||||||
android:title="@string/export_bookmarks"
|
|
||||||
app:showAsAction="always" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_import_bookmarks"
|
android:id="@+id/action_import_bookmarks"
|
||||||
android:icon="@drawable/ic_import_bookmarks"
|
android:icon="@drawable/ic_import_bookmarks"
|
||||||
android:title="@string/import_bookmarks"
|
android:title="@string/import_bookmarks"
|
||||||
|
app:tint="?attr/menuIconColor"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -5,19 +5,6 @@
|
||||||
android:id="@+id/action_translate"
|
android:id="@+id/action_translate"
|
||||||
android:title="@string/translate"
|
android:title="@string/translate"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_bookmark"
|
|
||||||
android:actionLayout="@layout/bookmark_layout"
|
|
||||||
android:title="@string/bookmark_add"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_admin"
|
|
||||||
android:title="@string/administration"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_stats"
|
|
||||||
android:title="@string/action_stats"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_info"
|
android:id="@+id/action_info"
|
||||||
android:title="@string/information"
|
android:title="@string/information"
|
||||||
|
@ -30,19 +17,10 @@
|
||||||
android:id="@+id/action_share"
|
android:id="@+id/action_share"
|
||||||
android:title="@string/more_action_6"
|
android:title="@string/more_action_6"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_custom_sharing"
|
|
||||||
android:title="@string/settings_title_custom_sharing"
|
|
||||||
android:visible="false"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_copy_link"
|
android:id="@+id/action_copy_link"
|
||||||
android:title="@string/copy_link"
|
android:title="@string/copy_link"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_mute_conversation"
|
|
||||||
android:title="@string/mute_conversation"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_mute"
|
android:id="@+id/action_mute"
|
||||||
android:title="@string/more_action_1"
|
android:title="@string/more_action_1"
|
||||||
|
@ -51,38 +29,13 @@
|
||||||
android:id="@+id/action_timed_mute"
|
android:id="@+id/action_timed_mute"
|
||||||
android:title="@string/more_action_8"
|
android:title="@string/more_action_8"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_schedule_boost"
|
|
||||||
android:title="@string/schedule_boost"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_block"
|
android:id="@+id/action_block"
|
||||||
android:title="@string/more_action_2"
|
android:title="@string/more_action_2"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_report"
|
|
||||||
android:title="@string/more_action_3"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_block_domain"
|
|
||||||
android:title="@string/block_domain"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_redraft"
|
|
||||||
android:title="@string/more_action_9"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_remove"
|
android:id="@+id/action_remove"
|
||||||
android:title="@string/more_action_4"
|
android:title="@string/more_action_4"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
<item
|
|
||||||
android:id="@+id/action_copy"
|
|
||||||
android:title="@string/more_action_5"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_mention"
|
|
||||||
android:title="@string/more_action_7"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
Loading…
Reference in New Issue