Comment #477 - Add button to display messages remotely

This commit is contained in:
Thomas 2022-11-19 17:17:23 +01:00
parent fdc365dc00
commit 4263d6f842
4 changed files with 58 additions and 12 deletions

View File

@ -142,14 +142,13 @@ public class ProfileActivity extends BaseActivity {
ActionBar actionBar = getSupportActionBar();
Bundle b = getIntent().getExtras();
binding.accountFollow.setEnabled(false);
checkRemotely = true;
checkRemotely = false;
if (b != null) {
account = (Account) b.getSerializable(Helper.ARG_ACCOUNT);
account_id = b.getString(Helper.ARG_USER_ID, null);
mention_str = b.getString(Helper.ARG_MENTION, null);
checkRemotely = b.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
}
checkRemotely = true;
postponeEnterTransition();
//Remove title
@ -343,11 +342,25 @@ public class ProfileActivity extends BaseActivity {
binding.accountMoved.setMovementMethod(LinkMovementMethod.getInstance());
}
if (account.acct != null && account.acct.contains("@"))
binding.warningMessage.setVisibility(View.VISIBLE);
binding.warningContainer.setVisibility(View.VISIBLE);
else
binding.warningMessage.setVisibility(View.GONE);
binding.warningContainer.setVisibility(View.GONE);
binding.openRemoteProfile.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
if (checkRemotely) {
binding.openRemoteProfile.setVisibility(View.GONE);
}
binding.openRemoteProfile.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, ProfileActivity.class);
Bundle b = new Bundle();
b.putSerializable(Helper.ARG_ACCOUNT, account);
b.putSerializable(Helper.ARG_CHECK_REMOTELY, true);
intent.putExtras(b);
ActivityOptionsCompat options = ActivityOptionsCompat
.makeSceneTransitionAnimation(ProfileActivity.this, binding.profilePicture, getString(R.string.activity_porfile_pp));
startActivity(intent, options.toBundle());
finish();
});
//Fields for profile
List<Field> fields = account.fields;
if (fields != null && fields.size() > 0) {

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M7,9H2V7h5V9zM7,12H2v2h5V12zM20.59,19l-3.83,-3.83C15.96,15.69 15.02,16 14,16c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5s5,2.24 5,5c0,1.02 -0.31,1.96 -0.83,2.75L22,17.59L20.59,19zM17,11c0,-1.65 -1.35,-3 -3,-3s-3,1.35 -3,3s1.35,3 3,3S17,12.65 17,11zM2,19h10v-2H2V19z" />
</vector>

View File

@ -325,18 +325,39 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/info" />
<!-- End Fields container -->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/warning_message"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/warning_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/disclaimer_full"
android:textColor="@color/dark_text"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fields_container" />
app:layout_constraintTop_toBottomOf="@+id/fields_container"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/warning_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="@string/disclaimer_full"
android:textColor="@color/dark_text" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/open_remote_profile"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:contentDescription="@string/display_remote_profile"
android:scaleType="fitCenter"
android:src="@drawable/ic_baseline_manage_search_24" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1899,4 +1899,5 @@
<string name="show_anyway">Show anyway</string>
<string name="filtered_by">Filtered: %1$s</string>
<string name="toast_error_add_to_list">The app failed to add the account into the list!</string>
<string name="display_remote_profile">Display remote profile</string>
</resources>