Some fixes

This commit is contained in:
Thomas 2023-01-25 12:18:02 +01:00
parent 44ff9225bc
commit 5ce553f8cf
5 changed files with 13 additions and 39 deletions
app/src/main

View file

@ -316,7 +316,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
}
};
private NetworkStateReceiver networkStateReceiver;
private static boolean headerMenuOpen;
public static boolean headerMenuOpen;
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);

View file

@ -32,7 +32,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
@ -104,22 +103,8 @@ public class AccountActivity extends BaseBarActivity {
binding.instance.setText(account.getHost());
BaseAccount finalBaseAccount = baseAccount;
binding.logoutButton.setOnClickListener(v -> {
AlertDialog.Builder dialogBuilderLogoutAccount = new AlertDialog.Builder(AccountActivity.this);
dialogBuilderLogoutAccount.setMessage(getString(R.string.logout_account_confirmation, account.getUsername(), account.getHost()));
dialogBuilderLogoutAccount.setPositiveButton(R.string.action_logout, (dialog, id) -> {
Helper.logoutCurrentUser(AccountActivity.this, finalBaseAccount);
dialog.dismiss();
});
dialogBuilderLogoutAccount.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
AlertDialog alertDialogLogoutAccount = dialogBuilderLogoutAccount.create();
alertDialogLogoutAccount.show();
});
binding.settings.setOnClickListener(v -> {
Intent intent = new Intent(AccountActivity.this, SettingsActivity.class);
startActivity(intent);
binding.editButton.setOnClickListener(v -> {
startActivity(new Intent(AccountActivity.this, MyAccountActivity.class));
});

View file

@ -18,6 +18,7 @@ import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken;
import static app.fedilab.android.BaseMainActivity.fetchRecentAccounts;
import static app.fedilab.android.BaseMainActivity.headerMenuOpen;
import static app.fedilab.android.BaseMainActivity.manageDrawerMenu;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
@ -114,7 +115,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
private DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
private DisplayOverviewFragment overviewFragment;
private ActivityMainPeertubeBinding binding;
private static boolean headerMenuOpen;
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= item -> {
@ -295,18 +295,19 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
headerMainBinding.accountAcc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
app.fedilab.android.mastodon.helper.Helper.loadPP(PeertubeMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false);
headerMainBinding.backgroundImage.setAlpha(0.5f);
headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.changeAccount.callOnClick());
headerMainBinding.changeAccount.setOnClickListener(v -> {
headerMenuOpen = !headerMenuOpen;
manageDrawerMenu(PeertubeMainActivity.this, binding.drawerNavView, headerMainBinding);
});
};
mainHandler.post(myRunnable);
}).start();
headerMainBinding.instanceInfo.setVisibility(View.GONE);
headerMainBinding.headerOptionInfo.setVisibility(View.GONE);
binding.drawerNavView.addHeaderView(headerMainBinding.getRoot());
headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.changeAccount.callOnClick());
headerMainBinding.changeAccount.setOnClickListener(v -> {
headerMenuOpen = !headerMenuOpen;
manageDrawerMenu(PeertubeMainActivity.this, binding.drawerNavView, headerMainBinding);
});
binding.drawerNavView.setNavigationItemSelectedListener(item -> {
if (item.getItemId() == R.id.action_settings) {
Intent intent = new Intent(PeertubeMainActivity.this, SettingsActivity.class);

View file

@ -250,7 +250,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
AlertDialog alertDialog = dialogBuilder.create();
int position;
if (oldChannelValues == null) {
position = -1;
position = 0;
} else {
position = 0;
for (ChannelData.Channel channel : channels) {

View file

@ -106,28 +106,16 @@
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/logout_button"
android:id="@+id/edit_button"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/action_logout"
android:text="@string/edit"
android:textAllCaps="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/settings"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/settings"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logout_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>