Skip to content

Commit bd6cfbd

Browse files
committed
show package info on about activity
1 parent 52e7a41 commit bd6cfbd

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

chat/src/main/java/cn/wildfire/chat/kit/setting/AboutActivity.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
11
package cn.wildfire.chat.kit.setting;
22

3+
import android.content.pm.PackageInfo;
4+
import android.content.pm.PackageManager;
5+
import android.widget.TextView;
6+
7+
import butterknife.Bind;
38
import butterknife.OnClick;
9+
import cn.wildfire.chat.app.Config;
410
import cn.wildfire.chat.kit.WfcBaseActivity;
511
import cn.wildfire.chat.kit.WfcWebViewActivity;
612
import cn.wildfirechat.chat.R;
713

814
public class AboutActivity extends WfcBaseActivity {
915

16+
@Bind(R.id.infoTextView)
17+
TextView infoTextView;
18+
1019
@Override
1120
protected int contentLayout() {
1221
return R.layout.activity_about;
1322
}
1423

24+
@Override
25+
protected void afterViews() {
26+
PackageManager packageManager = getPackageManager();
27+
try {
28+
PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), PackageManager.GET_CONFIGURATIONS);
29+
String info = packageInfo.packageName + "\n"
30+
+ packageInfo.versionCode + " " + packageInfo.versionName + "\n"
31+
+ Config.IM_SERVER_HOST + " " + Config.IM_SERVER_PORT + "\n"
32+
+ Config.APP_SERVER_HOST + " " + Config.APP_SERVER_PORT + "\n"
33+
+ Config.ICE_ADDRESS + " " + Config.ICE_USERNAME + " " + Config.ICE_PASSWORD + "\n";
34+
35+
infoTextView.setText(info);
36+
37+
} catch (PackageManager.NameNotFoundException e) {
38+
e.printStackTrace();
39+
}
40+
}
41+
1542
@OnClick(R.id.introOptionItemView)
1643
public void intro() {
1744
WfcWebViewActivity.loadUrl(this, "野火IM用户协议", "http://docs.wildfirechat.cn/");

chat/src/main/res/layout/activity_about.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
<RelativeLayout
1212
android:layout_width="match_parent"
13-
android:layout_height="150dp">
13+
android:layout_height="wrap_content"
14+
android:minHeight="150dp">
1415

1516
<LinearLayout
1617
android:layout_width="wrap_content"
@@ -31,6 +32,11 @@
3132
android:text="@string/app_name_in_about"
3233
android:textColor="@color/gray2"
3334
android:textSize="18sp" />
35+
36+
<TextView
37+
android:id="@+id/infoTextView"
38+
android:layout_width="wrap_content"
39+
android:layout_height="wrap_content" />
3440
</LinearLayout>
3541
</RelativeLayout>
3642

0 commit comments

Comments
 (0)