Merge pull request #1101 from nextcloud/removeNextcloudTalkHardcoding

Remove "Nextcloud" hardcoding
This commit is contained in:
Marcel Hibbe 2021-04-07 10:54:36 +02:00 committed by GitHub
commit 1251ef7254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 10 deletions

View file

@ -2363,11 +2363,9 @@ public class CallController extends BaseController {
private String getDescriptionForCallType() { private String getDescriptionForCallType() {
String appName = getResources().getString(R.string.nc_app_name); String appName = getResources().getString(R.string.nc_app_name);
if (isVoiceOnlyCall){ if (isVoiceOnlyCall){
return String.format(getResources().getString(R.string.nc_call_voice), return String.format(getResources().getString(R.string.nc_call_voice), appName);
getResources().getString(R.string.nc_app_name));
} else { } else {
return String.format(getResources().getString(R.string.nc_call_video), return String.format(getResources().getString(R.string.nc_call_video), appName);
getResources().getString(R.string.nc_app_name));
} }
} }

View file

@ -207,4 +207,19 @@ public interface User extends Parcelable, Persistable, Serializable {
} }
return "/Talk"; return "/Talk";
} }
default String getServerName() {
if (getCapabilities() != null) {
Capabilities capabilities;
try {
capabilities = LoganSquare.parse(getCapabilities(), Capabilities.class);
if (capabilities != null && capabilities.getThemingCapability() != null) {
return capabilities.getThemingCapability().getName();
}
} catch (IOException e) {
Log.e("User.java", "Failed to get server name", e);
}
}
return "";
}
} }

View file

@ -28,7 +28,7 @@ import org.parceler.Parcel;
@Parcel @Parcel
@Data @Data
@JsonObject @JsonObject
class ThemingCapability { public class ThemingCapability {
@JsonField(name = "name") @JsonField(name = "name")
String name; String name;

View file

@ -33,7 +33,7 @@ import com.nextcloud.talk.components.filebrowser.controllers.BrowserController
import com.nextcloud.talk.controllers.ChatController import com.nextcloud.talk.controllers.ChatController
class AttachmentDialog(val activity: Activity, var chatController :ChatController) : BottomSheetDialog(activity) { class AttachmentDialog(val activity: Activity, var chatController: ChatController) : BottomSheetDialog(activity) {
@BindView(R.id.txt_attach_file_from_local) @BindView(R.id.txt_attach_file_from_local)
@JvmField @JvmField
@ -49,11 +49,17 @@ class AttachmentDialog(val activity: Activity, var chatController :ChatControlle
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val view = layoutInflater.inflate(R.layout.dialog_attachment, null) val view = layoutInflater.inflate(R.layout.dialog_attachment, null)
setContentView(view) setContentView(view)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
unbinder = ButterKnife.bind(this, view) unbinder = ButterKnife.bind(this, view)
var serverName = chatController.conversationUser?.serverName
attachFromCloud?.text = chatController.resources?.let {
if(serverName.isNullOrEmpty()){
serverName = it.getString(R.string.nc_server_product_name)
}
String.format(it.getString(R.string.nc_upload_from_cloud), serverName)
}
attachFromLocal?.setOnClickListener { attachFromLocal?.setOnClickListener {
chatController.sendSelectLocalFileIntent() chatController.sendSelectLocalFileIntent()
dismiss() dismiss()

View file

@ -39,7 +39,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:padding="15dp" android:padding="15dp"
android:text="@string/nc_upload_from_nextcloud"
android:textSize="20sp" /> android:textSize="20sp" />
</LinearLayout> </LinearLayout>

View file

@ -337,7 +337,7 @@
<!-- Upload --> <!-- Upload -->
<string name="nc_upload_local_file">Upload local file</string> <string name="nc_upload_local_file">Upload local file</string>
<string name="nc_upload_from_nextcloud">Share from Nextcloud</string> <string name="nc_upload_from_cloud">Share from %1$s</string>
<string name="nc_upload_failed">Sorry, upload failed</string> <string name="nc_upload_failed">Sorry, upload failed</string>
<string name="nc_upload_choose_local_files">Choose files</string> <string name="nc_upload_choose_local_files">Choose files</string>
<string name="nc_upload_confirm_send_multiple">Send these files to %1$s?</string> <string name="nc_upload_confirm_send_multiple">Send these files to %1$s?</string>