From 92b33ef71c35f5525498119af102f59f19aefdb2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 23 Nov 2018 18:09:34 +0100 Subject: [PATCH] Improved code related to top bar in some views --- .../java/org/linphone/LinphoneActivity.java | 17 +- .../org/linphone/fragments/AboutFragment.java | 6 - app/src/main/res/layout-land/about.xml | 40 +- app/src/main/res/layout-land/main.xml | 501 ++++++++--------- app/src/main/res/layout-sw533dp-land/main.xml | 507 +++++++++--------- app/src/main/res/layout-sw533dp/main.xml | 506 ++++++++--------- app/src/main/res/layout/about.xml | 34 -- app/src/main/res/layout/main.xml | 483 +++++++++-------- 8 files changed, 1035 insertions(+), 1059 deletions(-) diff --git a/app/src/main/java/org/linphone/LinphoneActivity.java b/app/src/main/java/org/linphone/LinphoneActivity.java index e3b166639..0b3863395 100644 --- a/app/src/main/java/org/linphone/LinphoneActivity.java +++ b/app/src/main/java/org/linphone/LinphoneActivity.java @@ -136,7 +136,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick private TextView missedCalls, missedChats; private RelativeLayout contacts, history, dialer, chat; private View contacts_selected, history_selected, dialer_selected, chat_selected; - private RelativeLayout mTopBar; + private LinearLayout mTopBar; + private TextView mTopBarTitle; private ImageView cancel; private FragmentsAvailable pendingFragmentTransaction, currentFragment, leftFragment; private Fragment fragment; @@ -303,6 +304,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick private void initButtons() { mTabBar = findViewById(R.id.footer); mTopBar = findViewById(R.id.top_bar); + mTopBarTitle = findViewById(R.id.top_bar_title); cancel = findViewById(R.id.cancel); cancel.setOnClickListener(this); @@ -847,6 +849,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick public void hideTopBar() { mTopBar.setVisibility(View.GONE); + mTopBarTitle.setText(""); + } + + public void showTopBar() { + mTopBar.setVisibility(View.VISIBLE); + } + + public void showTopBarWithTitle(String title) { + showTopBar(); + mTopBarTitle.setText(title); } @SuppressWarnings("incomplete-switch") @@ -880,9 +892,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick case SETTINGS: case ACCOUNT_SETTINGS: hideTabBar(hideBottomBar); - mTopBar.setVisibility(View.VISIBLE); + showTopBarWithTitle(getString(R.string.settings)); break; case ABOUT: + showTopBarWithTitle(getString(R.string.about)); hideTabBar(hideBottomBar); break; case CHAT_LIST: diff --git a/app/src/main/java/org/linphone/fragments/AboutFragment.java b/app/src/main/java/org/linphone/fragments/AboutFragment.java index b4bf6064e..3f5eb94ee 100644 --- a/app/src/main/java/org/linphone/fragments/AboutFragment.java +++ b/app/src/main/java/org/linphone/fragments/AboutFragment.java @@ -48,7 +48,6 @@ import org.linphone.mediastream.Log; public class AboutFragment extends Fragment implements OnClickListener { View sendLogButton = null; View resetLogButton = null; - ImageView cancel; CoreListenerStub mListener; private ProgressDialog progress; private boolean uploadInProgress; @@ -62,9 +61,6 @@ public class AboutFragment extends Fragment implements OnClickListener { aboutLiblinphoneVersion.setText(String.format(getString(R.string.about_liblinphone_version), LinphoneManager.getLc().getVersion())); aboutVersion.setText(String.format(getString(R.string.about_version), BuildConfig.VERSION_NAME)); - cancel = view.findViewById(R.id.cancel); - cancel.setOnClickListener(this); - sendLogButton = view.findViewById(R.id.send_log); sendLogButton.setOnClickListener(this); sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); @@ -162,8 +158,6 @@ public class AboutFragment extends Fragment implements OnClickListener { if (lc != null) { lc.resetLogCollection(); } - } else if (v == cancel) { - LinphoneActivity.instance().goToDialerFragment(); } } } diff --git a/app/src/main/res/layout-land/about.xml b/app/src/main/res/layout-land/about.xml index aeda1db2c..05198177f 100644 --- a/app/src/main/res/layout-land/about.xml +++ b/app/src/main/res/layout-land/about.xml @@ -1,42 +1,8 @@ - - - - - - - - - + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + - + - + - + - + - + - + - + - + - - + - + + - + - + - + - + - + - + - + - + - - + - + + - + - + - + - + - + - + - + - - + - + - - + - - + - + - + - - + + - + - + - + + - + - + - - + - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw533dp-land/main.xml b/app/src/main/res/layout-sw533dp-land/main.xml index 302ca4dc2..ae19b1f2d 100644 --- a/app/src/main/res/layout-sw533dp-land/main.xml +++ b/app/src/main/res/layout-sw533dp-land/main.xml @@ -1,297 +1,306 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + - + - + - + - + - + - + - + - + - + - + - + - - + - - + + - + - + - + - + - + - + - + - + - + - - + - + - + + - + - + - + - + - + - + - - - + - - + - + - + - + - - + + - + - + - + - + + - + - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw533dp/main.xml b/app/src/main/res/layout-sw533dp/main.xml index 83e455609..7a953c23f 100644 --- a/app/src/main/res/layout-sw533dp/main.xml +++ b/app/src/main/res/layout-sw533dp/main.xml @@ -1,296 +1,306 @@ + xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + - + - + - + - + - + - + - + - + - + - - + - + - + - + + - + - + - + - + - + - - - + - - + - + - + - + - - + - + + - + - + - + - + + - + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index e46a2083a..149e30e98 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -5,40 +5,6 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - - - - - - - - + - + - + - + - + - + - + - + - + - - + - + + - + - + - + - + - + - + - + - + - - + - + + - + - + - + - + - + - + - + - - + - + - - + - - + - + - + - - + + - + - + - + + - - - + - - + - + + + + + + + + + + + \ No newline at end of file