Skip to content

Commit

Permalink
Merge pull request #107 from smartzhao/main
Browse files Browse the repository at this point in the history
feat: [android] [1.9.0] update 1.9.0 API doc.
  • Loading branch information
chandarlee authored May 31, 2021
2 parents d1a54cd + 1c3fd6a commit 56a9c96
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;

import com.netease.meetinglib.demo.utils.SPUtils;

import org.jetbrains.annotations.NotNull;

public class AppSettingsActivity extends AppCompatActivity {

public static void start(Context context) {
Expand Down Expand Up @@ -45,6 +52,17 @@ public static class AppSettingsFragment extends PreferenceFragmentCompat {
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
getPreferenceManager().setSharedPreferencesName(SPUtils.SP_FILE);
setPreferencesFromResource(R.xml.app_settings, rootKey);
EditTextPreference numberPreference = findPreference("meeting-logger-level-config");

if (numberPreference != null) {
numberPreference.setOnBindEditTextListener(
new EditTextPreference.OnBindEditTextListener() {
@Override
public void onBindEditText(@NonNull EditText editText) {
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
}
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import com.netease.meetinglib.demo.nim.NIMInitializer;
import com.netease.meetinglib.demo.utils.SPUtils;
import com.netease.meetinglib.sdk.NELogLevel;
import com.netease.meetinglib.sdk.NELoggerConfig;
import com.netease.meetinglib.sdk.NEMeetingError;
import com.netease.meetinglib.sdk.NEMeetingSDK;
import com.netease.meetinglib.sdk.NEMeetingSDKConfig;
Expand Down Expand Up @@ -74,6 +76,19 @@ public void removeListener(InitializeListener listener) {
}
}

public int getLoggerLevelConfig() {
int level = 0;
try {
level = Integer.parseInt(SPUtils.getInstance().getString("meeting-logger-level-config"));
} catch (NumberFormatException ignored) {
}
return level;
}

public String getLoggerPathConfig() {
return SPUtils.getInstance().getString("meeting-logger-path-config");
}

private void initializeSdk() {
Log.i(TAG, "initializeSdk");
NEMeetingSDKConfig config = new NEMeetingSDKConfig();
Expand All @@ -85,6 +100,10 @@ private void initializeSdk() {
NEForegroundServiceConfig foregroundServiceConfig = new NEForegroundServiceConfig();
foregroundServiceConfig.contentTitle = context.getString(R.string.app_name);
config.foregroundServiceConfig = foregroundServiceConfig;
NELoggerConfig loggerConfig = new NELoggerConfig();
loggerConfig.level = NELogLevel.of(getLoggerLevelConfig());
loggerConfig.path = getLoggerPathConfig();
config.loggerConfig = loggerConfig;
NEMeetingSDK.getInstance().initialize(context, config, new ToastCallback<Void>(context,"初始化"){
@Override
public void onResult(int resultCode, String resultMsg, Void resultData) {
Expand Down
9 changes: 9 additions & 0 deletions SampleCode/Android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
<item name="iconSpaceReserved">false</item>
</style>

<style name="MyEditTextPreference" parent="Preference.DialogPreference.EditTextPreference.Material">
<item name="android:layout">@layout/preference_material</item>
<item name="allowDividerAbove">false</item>
<item name="allowDividerBelow">true</item>
<item name="singleLineTitle">false</item>
<item name="iconSpaceReserved">false</item>
<!-- <item name="iconSpaceReserved">@bool/config_materialPreferenceIconSpaceReserved</item>-->
</style>

<style name="MyDialogStyle">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
Expand Down
14 changes: 14 additions & 0 deletions SampleCode/Android/app/src/main/res/xml/app_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,19 @@
style="@style/MySwitchPreference"
/>

<EditTextPreference
app:key="meeting-logger-level-config"
app:title="自定义日志输出等级配置"
app:summary="重启应用后生效"
app:defaultValue="0"
style="@style/MyEditTextPreference"
/>

<EditTextPreference
app:key="meeting-logger-path-config"
app:title="自定义日志路径配置"
app:summary="重启应用后生效"
app:defaultValue="/sdcard/Android/data/com.netease.meetinglib.demo/files/log/"
style="@style/MyEditTextPreference"
/>
</PreferenceScreen>
6 changes: 0 additions & 6 deletions SampleCode/Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ buildscript {
repositories {
google()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
mavenCentral()
}
dependencies {
Expand All @@ -20,9 +17,6 @@ allprojects {
repositories {
google()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
mavenCentral()
}
}
Expand Down
9 changes: 8 additions & 1 deletion SampleCode/iOS/NEMeetingDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ - (void)doSetupMeetingSdk {
NEMeetingSDKConfig *config = [[NEMeetingSDKConfig alloc] init];
config.appKey = kAppKey;
config.reuseNIM = [LoginInfoManager shareInstance].reuseNIM;
config.enableDebugLog = YES;
// config.enableDebugLog = YES;
config.appName = @"测试APP Name";
NELoggerConfig *loggerConfig = [[NELoggerConfig alloc] init];
//默认等级
loggerConfig.level = NELogLevelVerbose;
// Document路径
NSString *sdkDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
loggerConfig.path = [sdkDir stringByAppendingString: @"/log"];
config.loggerConfig = loggerConfig;
#if PRIVATE
/// 私有化AppKey
config.useAssetServerConfig = YES;
Expand Down
2 changes: 1 addition & 1 deletion 开发文档/SDK集成/Android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
* 新增切换音频模式开关入会配置:
- `NEMeetingOptions.noSwitchAudioMode`
* 新增SIP拨号入会

## Changed

* 废弃`com.netease.meetinglib.sdk.NEMeetingMenuItem`菜单类,使用`com.netease.meetinglib.sdk.menu.NEMeetingMenuItem`代替
Expand Down

0 comments on commit 56a9c96

Please sign in to comment.