This commit is contained in:
Thomas 2022-09-08 08:49:42 +02:00
parent 9ce6c56771
commit b60780bcb0
2 changed files with 69 additions and 89 deletions

View File

@ -55,7 +55,6 @@
<activity
android:exported="true"
android:name=".activities.LoginActivity"
android:noHistory="true"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
@ -76,47 +75,37 @@
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.DraftActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".imageeditor.EditImageActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.ComposeActivity"
android:noHistory="true"
android:configChanges="orientation|screenSize"
android:label="@string/compose" />
<activity
android:name=".activities.StatusInfoActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.FollowRequestActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.WebviewActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.ProfileActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/account" />
<activity
android:name=".activities.AdminAccountActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/account" />
<activity
android:name=".activities.ScheduledActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/scheduled" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:noHistory="true"
android:theme="@style/Base.Theme.AppCompat" />
<service
@ -125,123 +114,102 @@
<activity
android:name=".activities.SearchResultTabActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/AppThemeBar"
android:label="@string/search" />
<activity
android:name=".activities.TrendsActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/trending"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.ReorderTimelinesActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/reorder_timelines"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.AboutActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_about"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.PartnerShipActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_about"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.ActionActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/interactions"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.AdminActionActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/administration"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.MastodonListActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_lists"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.SettingsActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/settings"
android:theme="@style/AppThemeBar" />
<activity
android:name=".activities.InstanceActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_about_instance"
android:theme="@style/DialogDark" />
<activity
android:name=".activities.InstanceProfileActivity"
android:noHistory="true"
android:excludeFromRecents="true"
android:theme="@style/DialogDark" />
<activity
android:name=".activities.ProxyActivity"
android:noHistory="true"
android:excludeFromRecents="true"
android:theme="@style/DialogDark" />
<activity
android:name=".activities.HashTagActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.AnnouncementActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".activities.MediaActivity"
android:noHistory="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/TransparentDark" />
<activity
android:name=".activities.InstanceHealthActivity"
android:noHistory="true"
android:excludeFromRecents="true"
android:theme="@style/DialogDark" />
<activity
android:name=".activities.ReportActivity"
android:noHistory="true"
android:theme="@style/AppThemeBarDark"
android:windowSoftInputMode="stateVisible" />
<activity
android:name=".activities.CustomSharingActivity"
android:noHistory="true"
android:label="@string/settings_title_custom_sharing"
android:windowSoftInputMode="stateVisible"
android:theme="@style/AppThemeBarDark" />
<activity
android:name=".activities.FilterActivity"
android:noHistory="true"
android:label="@string/filters"
android:theme="@style/AppThemeBarDark"
android:windowSoftInputMode="stateVisible" />
<activity
android:name=".activities.EditProfileActivity"
android:noHistory="true"
android:label="@string/edit_profile"
android:theme="@style/AppThemeBarDark"
android:windowSoftInputMode="stateVisible" />
<activity
android:name=".activities.CacheActivity"
android:noHistory="true"
android:label="@string/action_cache"
android:theme="@style/AppThemeBarDark" />

View File

@ -665,7 +665,7 @@ public class ProfileActivity extends BaseActivity {
int itemId = item.getItemId();
String[] splitAcct = account.acct.split("@");
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ProfileActivity.this);
AlertDialog.Builder builderInner;
AlertDialog.Builder builderInner = null;
final boolean isOwner = account.id.compareToIgnoreCase(BaseMainActivity.currentUserID) == 0;
final String[] stringArrayConf;
if (isOwner) {
@ -882,15 +882,21 @@ public class ProfileActivity extends BaseActivity {
startActivity(intent);
return true;
} else if (itemId == R.id.action_mute) {
if (relationship.muting) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(stringArrayConf[4]);
doActionAccount = action.UNMUTE;
if (relationship != null) {
if (relationship.muting) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(stringArrayConf[4]);
doActionAccount = action.UNMUTE;
} else {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(stringArrayConf[0]);
doActionAccount = action.MUTE;
}
} else {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(stringArrayConf[0]);
doActionAccount = action.MUTE;
doActionAccount = action.NOTHING;
}
} else if (itemId == R.id.action_report) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(R.string.report_account);
@ -913,12 +919,16 @@ public class ProfileActivity extends BaseActivity {
return true;
} else if (itemId == R.id.action_block) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
if (relationship.blocking) {
builderInner.setTitle(stringArrayConf[5]);
doActionAccount = action.UNBLOCK;
if (relationship != null) {
if (relationship.blocking) {
builderInner.setTitle(stringArrayConf[5]);
doActionAccount = action.UNBLOCK;
} else {
builderInner.setTitle(stringArrayConf[1]);
doActionAccount = action.BLOCK;
}
} else {
builderInner.setTitle(stringArrayConf[1]);
doActionAccount = action.BLOCK;
doActionAccount = action.NOTHING;
}
} else if (itemId == R.id.action_block_instance) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
@ -928,50 +938,52 @@ public class ProfileActivity extends BaseActivity {
} else {
return true;
}
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
String target;
if (item.getItemId() == R.id.action_block_instance) {
target = account.acct.split("@")[1];
} else {
target = account.id;
}
switch (doActionAccount) {
case MUTE:
accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, true, 0)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case UNMUTE:
accountsVM.unmute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case BLOCK:
accountsVM.block(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case UNBLOCK:
accountsVM.unblock(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case BLOCK_DOMAIN:
accountsVM.addDomainBlocks(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target);
break;
}
dialog.dismiss();
});
builderInner.show();
if (doAction != action.NOTHING && builderInner != null) {
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
builderInner.setPositiveButton(R.string.yes, (dialog, which) -> {
String target;
if (item.getItemId() == R.id.action_block_instance) {
target = account.acct.split("@")[1];
} else {
target = account.id;
}
switch (doActionAccount) {
case MUTE:
accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target, true, 0)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case UNMUTE:
accountsVM.unmute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case BLOCK:
accountsVM.block(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case UNBLOCK:
accountsVM.unblock(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target)
.observe(ProfileActivity.this, relationShip -> {
this.relationship = relationShip;
updateAccount();
});
break;
case BLOCK_DOMAIN:
accountsVM.addDomainBlocks(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, target);
break;
}
dialog.dismiss();
});
builderInner.show();
}
return true;
}