diff --git a/app/assets/fonts/Nunito-Black.ttf b/app/assets/fonts/Nunito-Black.ttf new file mode 100644 index 000000000..45fdbcc81 Binary files /dev/null and b/app/assets/fonts/Nunito-Black.ttf differ diff --git a/app/assets/fonts/Nunito-BlackItalic.ttf b/app/assets/fonts/Nunito-BlackItalic.ttf new file mode 100644 index 000000000..ef7b7f3c9 Binary files /dev/null and b/app/assets/fonts/Nunito-BlackItalic.ttf differ diff --git a/app/assets/fonts/Nunito-Bold.ttf b/app/assets/fonts/Nunito-Bold.ttf new file mode 100644 index 000000000..56087d9db Binary files /dev/null and b/app/assets/fonts/Nunito-Bold.ttf differ diff --git a/app/assets/fonts/Nunito-BoldItalic.ttf b/app/assets/fonts/Nunito-BoldItalic.ttf new file mode 100644 index 000000000..f22b33466 Binary files /dev/null and b/app/assets/fonts/Nunito-BoldItalic.ttf differ diff --git a/app/assets/fonts/Nunito-ExtraBold.ttf b/app/assets/fonts/Nunito-ExtraBold.ttf new file mode 100644 index 000000000..198757110 Binary files /dev/null and b/app/assets/fonts/Nunito-ExtraBold.ttf differ diff --git a/app/assets/fonts/Nunito-ExtraBoldItalic.ttf b/app/assets/fonts/Nunito-ExtraBoldItalic.ttf new file mode 100644 index 000000000..247967ed3 Binary files /dev/null and b/app/assets/fonts/Nunito-ExtraBoldItalic.ttf differ diff --git a/app/assets/fonts/Nunito-ExtraLight.ttf b/app/assets/fonts/Nunito-ExtraLight.ttf new file mode 100644 index 000000000..5c06e7577 Binary files /dev/null and b/app/assets/fonts/Nunito-ExtraLight.ttf differ diff --git a/app/assets/fonts/Nunito-ExtraLightItalic.ttf b/app/assets/fonts/Nunito-ExtraLightItalic.ttf new file mode 100644 index 000000000..d44c53c42 Binary files /dev/null and b/app/assets/fonts/Nunito-ExtraLightItalic.ttf differ diff --git a/app/assets/fonts/Nunito-Italic.ttf b/app/assets/fonts/Nunito-Italic.ttf new file mode 100644 index 000000000..97476e09f Binary files /dev/null and b/app/assets/fonts/Nunito-Italic.ttf differ diff --git a/app/assets/fonts/Nunito-Light.ttf b/app/assets/fonts/Nunito-Light.ttf new file mode 100644 index 000000000..9f3e7ddf5 Binary files /dev/null and b/app/assets/fonts/Nunito-Light.ttf differ diff --git a/app/assets/fonts/Nunito-LightItalic.ttf b/app/assets/fonts/Nunito-LightItalic.ttf new file mode 100644 index 000000000..513fb3722 Binary files /dev/null and b/app/assets/fonts/Nunito-LightItalic.ttf differ diff --git a/app/assets/fonts/Nunito-Regular.ttf b/app/assets/fonts/Nunito-Regular.ttf new file mode 100644 index 000000000..d3d345a85 Binary files /dev/null and b/app/assets/fonts/Nunito-Regular.ttf differ diff --git a/app/assets/fonts/Nunito-SemiBold.ttf b/app/assets/fonts/Nunito-SemiBold.ttf new file mode 100644 index 000000000..6f17695e9 Binary files /dev/null and b/app/assets/fonts/Nunito-SemiBold.ttf differ diff --git a/app/assets/fonts/Nunito-SemiBoldItalic.ttf b/app/assets/fonts/Nunito-SemiBoldItalic.ttf new file mode 100644 index 000000000..d932fe952 Binary files /dev/null and b/app/assets/fonts/Nunito-SemiBoldItalic.ttf differ diff --git a/app/assets/fonts/NunitoHeavy-Italic.ttf b/app/assets/fonts/NunitoHeavy-Italic.ttf new file mode 100644 index 000000000..c6554c78d Binary files /dev/null and b/app/assets/fonts/NunitoHeavy-Italic.ttf differ diff --git a/app/assets/fonts/NunitoHeavy-Regular.ttf b/app/assets/fonts/NunitoHeavy-Regular.ttf new file mode 100644 index 000000000..acefb3ad2 Binary files /dev/null and b/app/assets/fonts/NunitoHeavy-Regular.ttf differ diff --git a/app/build.gradle b/app/build.gradle index db44df625..6eb076457 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -190,6 +190,8 @@ dependencies { implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' implementation 'com.kevalpatel2106:emoticongifkeyboard:1.1' + compile 'uk.co.chrisjenx:calligraphy:2.3.0' + testImplementation 'junit:junit:4.12' androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0-alpha4', { exclude group: 'com.android.support', module: 'support-annotations' diff --git a/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.java b/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.java index 9bce0a9c2..a1c82a89f 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/BaseActivity.java @@ -21,6 +21,7 @@ package com.nextcloud.talk.activities; import android.annotation.SuppressLint; +import android.content.Context; import android.os.Bundle; import android.util.Log; import android.webkit.SslErrorHandler; @@ -45,6 +46,7 @@ import javax.inject.Inject; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import autodagger.AutoInjector; +import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; @AutoInjector(NextcloudTalkApplication.class) public class BaseActivity extends AppCompatActivity { @@ -59,6 +61,11 @@ public class BaseActivity extends AppCompatActivity { NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this); } + @Override + protected void attachBaseContext(Context newBase) { + super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); + } + public void showCertificateDialog(X509Certificate cert, MagicTrustManager magicTrustManager, @Nullable SslErrorHandler sslErrorHandler) { DateFormat formatter = DateFormat.getDateInstance(DateFormat.LONG); diff --git a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java index b77621ee2..836da1bf7 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.java @@ -20,6 +20,7 @@ package com.nextcloud.talk.activities; +import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import android.view.View; @@ -45,6 +46,7 @@ import javax.inject.Inject; import autodagger.AutoInjector; import butterknife.BindView; import butterknife.ButterKnife; +import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; @AutoInjector(NextcloudTalkApplication.class) public class MagicCallActivity extends BaseActivity { @@ -64,6 +66,11 @@ public class MagicCallActivity extends BaseActivity { return flags; } + @Override + protected void attachBaseContext(Context newBase) { + super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase)); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java index cb9cdb911..067e55ef7 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java @@ -55,6 +55,7 @@ import androidx.work.PeriodicWorkRequest; import androidx.work.WorkManager; import autodagger.AutoComponent; import autodagger.AutoInjector; +import uk.co.chrisjenx.calligraphy.CalligraphyConfig; @AutoComponent( modules = { @@ -109,6 +110,11 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Lif public void onCreate() { super.onCreate(); + CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() + .setDefaultFontPath("fonts/Nunito-Regular.ttf") + .build() + ); + sharedApplication = this; initializeWebRtc(); diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebSocketInstance.java b/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebSocketInstance.java index eed1ed600..be2dc8f86 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebSocketInstance.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebSocketInstance.java @@ -36,7 +36,6 @@ import com.nextcloud.talk.models.json.websocket.EventOverallWebSocketMessage; import com.nextcloud.talk.models.json.websocket.HelloResponseOverallWebSocketMessage; import com.nextcloud.talk.models.json.websocket.JoinedRoomOverallWebSocketMessage; import com.nextcloud.talk.utils.MagicMap; -import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder; import org.greenrobot.eventbus.EventBus; @@ -93,16 +92,14 @@ public class MagicWebSocketInstance extends WebSocketListener { @Override public void onOpen(WebSocket webSocket, Response response) { - if (isConnected()) { - try { - if (TextUtils.isEmpty(resumeId)) { - webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModel(conversationUser, webSocketTicket))); - } else { - webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModelForResume(resumeId))); - } - } catch (IOException e) { - Log.e(TAG, "Failed to serialize hello model"); + try { + if (TextUtils.isEmpty(resumeId)) { + webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModel(conversationUser, webSocketTicket))); + } else { + webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModelForResume(resumeId))); } + } catch (IOException e) { + Log.e(TAG, "Failed to serialize hello model"); } } @@ -280,7 +277,7 @@ public class MagicWebSocketInstance extends WebSocketListener { ByeWebSocketMessage byeWebSocketMessage = new ByeWebSocketMessage(); byeWebSocketMessage.setType("bye"); byeWebSocketMessage.setBye(new HashMap<>()); - webSocket.send(LoganSquare.serialize(byeWebSocketMessage); + webSocket.send(LoganSquare.serialize(byeWebSocketMessage)); } catch (IOException e) { Log.e(TAG, "Failed to serialize bye message"); } diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketConnectionHelper.java b/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketConnectionHelper.java index 3c89e1e56..cf7ec9780 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketConnectionHelper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/WebSocketConnectionHelper.java @@ -67,7 +67,7 @@ public class WebSocketConnectionHelper { } MagicWebSocketInstance magicWebSocketInstance; - if ((magicWebSocketInstance = magicWebSocketInstanceMap.get(userEntity.getId())) != null && !magicWebSocketInstance.isPermanentlyClosed()) { + if (magicWebSocketInstanceMap.containsKey(userEntity.getId()) && (magicWebSocketInstance = magicWebSocketInstanceMap.get(userEntity.getId())) != null && !magicWebSocketInstance.isPermanentlyClosed()) { return magicWebSocketInstance; } else { magicWebSocketInstance = new MagicWebSocketInstance(userEntity, generatedURL, webSocketTicket);