forked from mirrors/Fedilab
Some fixes
This commit is contained in:
parent
44ff9225bc
commit
5ce553f8cf
5 changed files with 13 additions and 39 deletions
|
@ -316,7 +316,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private NetworkStateReceiver networkStateReceiver;
|
private NetworkStateReceiver networkStateReceiver;
|
||||||
private static boolean headerMenuOpen;
|
public static boolean headerMenuOpen;
|
||||||
|
|
||||||
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
|
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||||
|
@ -104,22 +103,8 @@ public class AccountActivity extends BaseBarActivity {
|
||||||
|
|
||||||
binding.instance.setText(account.getHost());
|
binding.instance.setText(account.getHost());
|
||||||
|
|
||||||
BaseAccount finalBaseAccount = baseAccount;
|
binding.editButton.setOnClickListener(v -> {
|
||||||
binding.logoutButton.setOnClickListener(v -> {
|
startActivity(new Intent(AccountActivity.this, MyAccountActivity.class));
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
import static app.fedilab.android.BaseMainActivity.currentInstance;
|
import static app.fedilab.android.BaseMainActivity.currentInstance;
|
||||||
import static app.fedilab.android.BaseMainActivity.currentToken;
|
import static app.fedilab.android.BaseMainActivity.currentToken;
|
||||||
import static app.fedilab.android.BaseMainActivity.fetchRecentAccounts;
|
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.BaseMainActivity.manageDrawerMenu;
|
||||||
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
|
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
|
||||||
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
|
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 DisplayVideosFragment recentFragment, locaFragment, trendingFragment, subscriptionFragment, mostLikedFragment;
|
||||||
private DisplayOverviewFragment overviewFragment;
|
private DisplayOverviewFragment overviewFragment;
|
||||||
private ActivityMainPeertubeBinding binding;
|
private ActivityMainPeertubeBinding binding;
|
||||||
private static boolean headerMenuOpen;
|
|
||||||
|
|
||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
|
@ -295,18 +295,19 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
||||||
headerMainBinding.accountAcc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
headerMainBinding.accountAcc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale);
|
||||||
app.fedilab.android.mastodon.helper.Helper.loadPP(PeertubeMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false);
|
app.fedilab.android.mastodon.helper.Helper.loadPP(PeertubeMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false);
|
||||||
headerMainBinding.backgroundImage.setAlpha(0.5f);
|
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);
|
mainHandler.post(myRunnable);
|
||||||
}).start();
|
}).start();
|
||||||
headerMainBinding.instanceInfo.setVisibility(View.GONE);
|
headerMainBinding.instanceInfo.setVisibility(View.GONE);
|
||||||
headerMainBinding.headerOptionInfo.setVisibility(View.GONE);
|
headerMainBinding.headerOptionInfo.setVisibility(View.GONE);
|
||||||
binding.drawerNavView.addHeaderView(headerMainBinding.getRoot());
|
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 -> {
|
binding.drawerNavView.setNavigationItemSelectedListener(item -> {
|
||||||
if (item.getItemId() == R.id.action_settings) {
|
if (item.getItemId() == R.id.action_settings) {
|
||||||
Intent intent = new Intent(PeertubeMainActivity.this, SettingsActivity.class);
|
Intent intent = new Intent(PeertubeMainActivity.this, SettingsActivity.class);
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
int position;
|
int position;
|
||||||
if (oldChannelValues == null) {
|
if (oldChannelValues == null) {
|
||||||
position = -1;
|
position = 0;
|
||||||
} else {
|
} else {
|
||||||
position = 0;
|
position = 0;
|
||||||
for (ChannelData.Channel channel : channels) {
|
for (ChannelData.Channel channel : channels) {
|
||||||
|
|
|
@ -106,28 +106,16 @@
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/logout_button"
|
android:id="@+id/edit_button"
|
||||||
style="@style/Widget.AppCompat.Button.Colored"
|
style="@style/Widget.AppCompat.Button.Colored"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="@string/action_logout"
|
android:text="@string/edit"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
Loading…
Reference in a new issue