Add edit profile in main settings

This commit is contained in:
Thomas 2022-07-11 09:13:16 +02:00
parent 13d8876626
commit 94c3dbcf25
3 changed files with 78 additions and 59 deletions

View File

@ -1064,11 +1064,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} }
@Override
protected void onResume() {
super.onResume();
}
public void redrawPinned(List<MastodonList> mastodonLists) { public void redrawPinned(List<MastodonList> mastodonLists) {
int currentItem = binding.viewPager.getCurrentItem(); int currentItem = binding.viewPager.getCurrentItem();
new ViewModelProvider(BaseMainActivity.this).get(TopBarVM.class).getDBPinned() new ViewModelProvider(BaseMainActivity.this).get(TopBarVM.class).getDBPinned()

View File

@ -16,6 +16,7 @@ package app.fedilab.android.activities;
import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
@ -62,6 +63,7 @@ public class SettingsActivity extends BaseActivity {
} }
canGoBack = false; canGoBack = false;
binding.setAccount.setOnClickListener(v -> displaySettings(SettingsEnum.ACCOUNT));
binding.setTimelines.setOnClickListener(v -> displaySettings(SettingsEnum.TIMELINES)); binding.setTimelines.setOnClickListener(v -> displaySettings(SettingsEnum.TIMELINES));
binding.setNotifications.setOnClickListener(v -> displaySettings(SettingsEnum.NOTIFICATIONS)); binding.setNotifications.setOnClickListener(v -> displaySettings(SettingsEnum.NOTIFICATIONS));
binding.setInterface.setOnClickListener(v -> displaySettings(SettingsEnum.INTERFACE)); binding.setInterface.setOnClickListener(v -> displaySettings(SettingsEnum.INTERFACE));
@ -79,6 +81,10 @@ public class SettingsActivity extends BaseActivity {
public void displaySettings(SettingsEnum settingsEnum) { public void displaySettings(SettingsEnum settingsEnum) {
if (settingsEnum == SettingsEnum.ACCOUNT) {
Intent intent = new Intent(SettingsActivity.this, EditProfileActivity.class);
startActivity(intent);
} else {
ThemeHelper.slideViewsToLeft(binding.buttonContainer, binding.fragmentContainer, () -> { ThemeHelper.slideViewsToLeft(binding.buttonContainer, binding.fragmentContainer, () -> {
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = FragmentTransaction fragmentTransaction =
@ -135,6 +141,7 @@ public class SettingsActivity extends BaseActivity {
fragmentTransaction.commit(); fragmentTransaction.commit();
}); });
} }
}
@Override @Override
@ -168,6 +175,8 @@ public class SettingsActivity extends BaseActivity {
public enum SettingsEnum { public enum SettingsEnum {
@SerializedName("ACCOUNT")
ACCOUNT("ACCOUNT"),
@SerializedName("TIMELINES") @SerializedName("TIMELINES")
TIMELINES("TIMELINES"), TIMELINES("TIMELINES"),
@SerializedName("NOTIFICATIONS") @SerializedName("NOTIFICATIONS")

View File

@ -16,12 +16,27 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="24dp"> android:padding="24dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/set_account"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="12dp"
android:text="@string/account"
android:textAlignment="textStart"
android:textColor="@color/cyanea_accent_dark_reference"
app:icon="@drawable/ic_baseline_navigate_next_24"
app:iconGravity="end"
app:iconTint="@color/cyanea_accent_dark_reference"
app:strokeColor="@color/cyanea_accent_dark_reference" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/set_timelines" android:id="@+id/set_timelines"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingVertical="12dp" android:paddingVertical="12dp"
android:layout_marginTop="24dp"
android:text="@string/settings_category_label_timelines" android:text="@string/settings_category_label_timelines"
android:textAlignment="textStart" android:textAlignment="textStart"
android:textColor="@color/cyanea_accent_dark_reference" android:textColor="@color/cyanea_accent_dark_reference"