This commit is contained in:
nuclearfog 2023-09-19 15:16:34 +02:00
parent c78df7a9c1
commit d304ea58a5
No known key found for this signature in database
GPG Key ID: 03488A185C476379
3 changed files with 14 additions and 10 deletions

View File

@ -217,12 +217,11 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
public void onBackPressed() { public void onBackPressed() {
if (viewPager.getCurrentItem() > 0) { if (viewPager.getCurrentItem() > 0) {
viewPager.setCurrentItem(0); viewPager.setCurrentItem(0);
} else { } else if (!drawerLayout.isOpen()) {
if (drawerLayout.isOpen()) {
drawerLayout.close();
} else {
super.onBackPressed(); super.onBackPressed();
} }
if (drawerLayout.isOpen()) {
drawerLayout.close();
} }
} }
@ -267,10 +266,13 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
setCurrentUser(((Account) serializable).getUser()); setCurrentUser(((Account) serializable).getUser());
} }
} }
// reset tab pages
adapter = new HomeAdapter(this);
viewPager.setAdapter(adapter);
break; break;
// current user's profile changed // current user's profile information like name or images were updated
case ProfileEditor.RETURN_PROFILE_CHANGED: case ProfileEditor.RETURN_PROFILE_UPDATED:
if (data != null) { if (data != null) {
Serializable serializable = data.getSerializableExtra(ProfileEditor.KEY_USER); Serializable serializable = data.getSerializableExtra(ProfileEditor.KEY_USER);
if (serializable instanceof User) { if (serializable instanceof User) {

View File

@ -62,7 +62,7 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, Asy
/** /**
* return code used if profile information has changed * return code used if profile information has changed
*/ */
public static final int RETURN_PROFILE_CHANGED = 0xF5C0E570; public static final int RETURN_PROFILE_UPDATED = 0xF5C0E570;
private UserUpdater editorAsync; private UserUpdater editorAsync;
private GlobalSettings settings; private GlobalSettings settings;
@ -246,7 +246,7 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, Asy
Intent data = new Intent(); Intent data = new Intent();
data.putExtra(KEY_USER, result.user); data.putExtra(KEY_USER, result.user);
Toast.makeText(getApplicationContext(), R.string.info_profile_updated, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.info_profile_updated, Toast.LENGTH_SHORT).show();
setResult(RETURN_PROFILE_CHANGED, data); setResult(RETURN_PROFILE_UPDATED, data);
finish(); finish();
} else { } else {
String message = ErrorUtils.getErrorMessage(this, result.exception); String message = ErrorUtils.getErrorMessage(this, result.exception);

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.method.ScrollingMovementMethod;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -61,6 +62,7 @@ public class DescriptionView extends LinearLayout implements OnClickListener {
label.setMaxLines(4); label.setMaxLines(4);
label.setMaxWidth(displayWidth / 2); label.setMaxWidth(displayWidth / 2);
label.setTextColor(settings.getTextColor()); label.setTextColor(settings.getTextColor());
label.setMovementMethod(ScrollingMovementMethod.getInstance());
closeButton.setImageDrawable(closeIcon); closeButton.setImageDrawable(closeIcon);
setBackground(background); setBackground(background);