Commit 2139d033 authored by Tiago Cunha's avatar Tiago Cunha

Added version info on some screens

We should move the info on the user menu to an about screen when we get one
Updated the version name to go along with the code
parent 7f855b85
......@@ -35,7 +35,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 5
versionName "1.0"
versionName "1.0-beta5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
......
......@@ -4,6 +4,7 @@ import android.support.design.widget.Snackbar;
import android.widget.TextView;
import org.json.JSONObject;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache;
import chat.rocket.android.helper.LogcatIfError;
......@@ -33,11 +34,18 @@ public class InputHostnameFragment extends AbstractServerConfigFragment {
@Override
protected void onSetupView() {
setupVersionInfo();
rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect());
serverConfigObserver.sub();
}
private void setupVersionInfo() {
TextView versionInfoView = (TextView) rootView.findViewById(R.id.version_info);
versionInfoView.setText(getString(R.string.version_info_text, BuildConfig.VERSION_NAME));
}
private void handleConnect() {
final String hostname = ServerPolicyHelper.enforceHostname(getHostname());
......
......@@ -9,6 +9,7 @@ import android.widget.TextView;
import java.util.HashMap;
import java.util.List;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R;
import chat.rocket.android.api.MethodCallHelper;
import chat.rocket.android.helper.TextUtils;
......
......@@ -8,6 +8,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.MethodCallHelper;
......@@ -71,7 +72,8 @@ public class SidebarMainFragment extends AbstractFragment {
if (realmHelper != null) {
roomsObserver = realmHelper
.createListObserver(
realm -> realm.where(RoomSubscription.class).equalTo(RoomSubscription.OPEN, true).findAll())
realm -> realm.where(RoomSubscription.class).equalTo(RoomSubscription.OPEN, true)
.findAll())
.setOnUpdateListener(list -> roomListManager.setRooms(list));
currentUserObserver = realmHelper
......@@ -102,6 +104,7 @@ public class SidebarMainFragment extends AbstractFragment {
setupUserStatusButtons();
setupLogoutButton();
setupAddChannelButton();
setupVersionInfo();
roomListManager = new RoomListManager(
rootView.findViewById(R.id.unread_title),
......@@ -193,6 +196,11 @@ public class SidebarMainFragment extends AbstractFragment {
});
}
private void setupVersionInfo() {
TextView versionInfoView = (TextView) rootView.findViewById(R.id.version_info);
versionInfoView.setText(getString(R.string.version_info_text, BuildConfig.VERSION_NAME));
}
private void showAddRoomDialog(DialogFragment dialog) {
Bundle args = new Bundle();
args.putString("serverConfigId", serverConfigId);
......
......@@ -49,4 +49,13 @@
app:fabSize="mini"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp" />
</LinearLayout>
<TextView
android:id="@+id/version_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_margin="@dimen/margin_8"
android:textColor="@android:color/white"
android:textAppearance="?attr/textAppearanceListItemSmall" />
</FrameLayout>
\ No newline at end of file
......@@ -236,6 +236,13 @@
android:text="@string/fragment_sidebar_main_logout_title"
android:textAppearance="?attr/textAppearanceListItemSmall" />
</LinearLayout>
<TextView
android:id="@+id/version_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?attr/textAppearanceListItemSmall" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
......@@ -44,4 +44,6 @@
<string name="video_upload_message_spec_title">Attach video</string>
<string name="input_hostname_invalid_server_message">Invalid server version</string>
<string name="version_info_text">Version: %s</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment