Some theme fixes with button + fix profile not updated when edited

This commit is contained in:
Thomas 2022-05-08 11:14:01 +02:00
parent 03e30bdfc3
commit 0f4408ba95
7 changed files with 36 additions and 5 deletions

View File

@ -46,6 +46,7 @@ import app.fedilab.android.client.mastodon.entities.Account;
import app.fedilab.android.client.mastodon.entities.Field;
import app.fedilab.android.databinding.AccountFieldItemBinding;
import app.fedilab.android.databinding.ActivityEditProfileBinding;
import app.fedilab.android.exception.DBException;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;
import app.fedilab.android.helper.ThemeHelper;
@ -190,6 +191,13 @@ public class EditProfileActivity extends BaseActivity {
binding.avatarProgress.setVisibility(View.GONE);
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
Helper.recreateMainActivity(EditProfileActivity.this);
new Thread(() -> {
try {
new app.fedilab.android.client.entities.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
} catch (DBException e) {
e.printStackTrace();
}
}).start();
});
} else if (requestCode == PICK_MEDIA_HEADER && resultCode == RESULT_OK) {
Glide.with(EditProfileActivity.this)
@ -203,6 +211,14 @@ public class EditProfileActivity extends BaseActivity {
sendBroadCast(account);
binding.headerProgress.setVisibility(View.GONE);
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
new Thread(() -> {
try {
new app.fedilab.android.client.entities.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
} catch (DBException e) {
e.printStackTrace();
}
}).start();
Helper.recreateMainActivity(EditProfileActivity.this);
});
}
@ -286,7 +302,15 @@ public class EditProfileActivity extends BaseActivity {
)
.observe(EditProfileActivity.this, account -> {
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
sendBroadCast(account);
new Thread(() -> {
try {
new app.fedilab.android.client.entities.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
sendBroadCast(account);
} catch (DBException e) {
e.printStackTrace();
}
}).start();
Toasty.success(EditProfileActivity.this, getString(R.string.profiled_updated), Toasty.LENGTH_LONG).show();
finish();
});

View File

@ -98,7 +98,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/set_custom_sharing_save"
style="@style/Base.Widget.AppCompat.Button.Colored"
style="@style/MyButtonColored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -114,7 +114,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/set_proxy_save"
style="@style/Base.Widget.AppCompat.Button.Colored"
style="@style/MyButtonColored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"

View File

@ -67,7 +67,7 @@
<com.google.android.material.button.MaterialButton
android:id="@+id/list_action"
style="@style/Widget.MaterialComponents.Button"
style="@style/MyButtonColored"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="12dp"

View File

@ -55,6 +55,7 @@
android:id="@+id/continue_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MyButtonColored"
android:text="@string/keepon"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -80,7 +80,7 @@
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/submit_vote"
style="@style/Widget.AppCompat.Button.Colored"
style="@style/MyButtonColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"

View File

@ -192,6 +192,12 @@
<item name="android:minHeight">48dp</item>
</style>
<style name="MyButtonColored" parent="Base.Widget.AppCompat.Button.Colored">
<item name="iconTint">@color/cyanea_accent_dark_reference</item>
<item name="strokeColor">@color/cyanea_accent_dark_reference</item>
<item name="rippleColor">@color/cyanea_accent_dark_reference</item>
<item name="android:backgroundTint">@color/cyanea_accent_dark_reference</item>
</style>
<style name="MyOutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="iconTint">@color/cyanea_accent_dark_reference</item>