Skip to content
Snippets Groups Projects
Commit dde513c2 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ui: fixes for Android 6.0

Use AppCompatTheme and AppCompatActivity where support widgets are used.

Tuleap: #31
Change-Id: Ic73fd8f52ef6acf1a88c70241e152255a3fe3ab4
parent da758d39
No related branches found
No related tags found
No related merge requests found
...@@ -128,7 +128,7 @@ as that of the covered work. ...@@ -128,7 +128,7 @@ as that of the covered work.
android:name=".client.CallActivity" android:name=".client.CallActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppThemeWithoutOverlay" android:theme="@style/AppThemeWithoutOverlayCompat"
android:windowSoftInputMode="adjustPan" > android:windowSoftInputMode="adjustPan" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" /> <action android:name="android.intent.action.CALL_PRIVILEGED" />
......
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
package cx.ring.client; package cx.ring.client;
import android.app.Activity; import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import cx.ring.R; import cx.ring.R;
import cx.ring.fragments.CallFragment; import cx.ring.fragments.CallFragment;
import cx.ring.model.Conversation; import cx.ring.model.Conversation;
import cx.ring.model.SipUri; import cx.ring.model.SipUri;
import cx.ring.model.TextMessage;
import cx.ring.model.account.Account; import cx.ring.model.account.Account;
import cx.ring.model.CallContact; import cx.ring.model.CallContact;
import cx.ring.model.Conference; import cx.ring.model.Conference;
...@@ -64,13 +64,15 @@ import android.view.KeyEvent; ...@@ -64,13 +64,15 @@ import android.view.KeyEvent;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
public class CallActivity extends Activity implements LocalService.Callbacks, CallFragment.Callbacks, CallProximityManager.ProximityDirector { import static cx.ring.service.LocalService.*;
public class CallActivity extends AppCompatActivity implements Callbacks, CallFragment.Callbacks, CallProximityManager.ProximityDirector {
@SuppressWarnings("unused") @SuppressWarnings("unused")
static final String TAG = "CallActivity"; static final String TAG = "CallActivity";
private boolean init = false; private boolean init = false;
private LocalService service; private LocalService service;
CallFragment mCurrentCallFragment; private CallFragment mCurrentCallFragment;
private Conference mDisplayedConference; private Conference mDisplayedConference;
/* result code sent in case of call failure */ /* result code sent in case of call failure */
......
...@@ -50,6 +50,7 @@ import android.os.Bundle; ...@@ -50,6 +50,7 @@ import android.os.Bundle;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.PowerManager.WakeLock; import android.os.PowerManager.WakeLock;
import android.os.RemoteException; import android.os.RemoteException;
import android.support.v7.app.ActionBar;
import android.util.Log; import android.util.Log;
import android.view.*; import android.view.*;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
...@@ -255,6 +256,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -255,6 +256,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
void terminateCall(); void terminateCall();
Conference getDisplayedConference(); Conference getDisplayedConference();
void updateDisplayedConference(Conference c); void updateDisplayedConference(Conference c);
ActionBar getSupportActionBar();
} }
/** /**
...@@ -272,6 +274,8 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -272,6 +274,8 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
@Override @Override
public void updateDisplayedConference(Conference c) { } public void updateDisplayedConference(Conference c) { }
@Override @Override
public ActionBar getSupportActionBar() { return null; }
@Override
public void startTimer() { } public void startTimer() { }
} }
private static final Callbacks sDummyCallbacks = new DummyCallbacks(); private static final Callbacks sDummyCallbacks = new DummyCallbacks();
...@@ -568,7 +572,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -568,7 +572,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity()); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity());
notificationManager.notify(getConference().notificationId, noti.build()); notificationManager.notify(getConference().notificationId, noti.build());
getActivity().getActionBar().setTitle(contact.getDisplayName()); mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
/*synchronized (mBubbleModel) { /*synchronized (mBubbleModel) {
mCallbacks.startTimer(); mCallbacks.startTimer();
...@@ -730,7 +734,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -730,7 +734,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity()); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity());
notificationManager.notify(getConference().notificationId, noti.build()); notificationManager.notify(getConference().notificationId, noti.build());
getActivity().getActionBar().setTitle(contact.getDisplayName()); mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
/*getBubbleFor(getConference().getParticipants().get(0), mBubbleModel.getWidth() / 2, 2 * mBubbleModel.getHeight() / 3); /*getBubbleFor(getConference().getParticipants().get(0), mBubbleModel.getWidth() / 2, 2 * mBubbleModel.getHeight() / 3);
...@@ -812,7 +816,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -812,7 +816,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity()); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getActivity());
notificationManager.notify(getConference().notificationId, noti.build()); notificationManager.notify(getConference().notificationId, noti.build());
getActivity().getActionBar().setTitle(contact.getDisplayName()); mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
/*synchronized (mBubbleModel) { /*synchronized (mBubbleModel) {
PointF c = mBubbleModel.getCircleCenter(); PointF c = mBubbleModel.getCircleCenter();
......
...@@ -149,7 +149,7 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText ...@@ -149,7 +149,7 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
} }
public void updateLists() { public void updateLists() {
if (mCallbacks.getService() != null) { if (mCallbacks.getService() != null && mConferenceAdapter != null) {
mConferenceAdapter.updateDataset(mCallbacks.getService().getConversations()); mConferenceAdapter.updateDataset(mCallbacks.getService().getConversations());
if (mCallbacks.getService().isConnected()) { if (mCallbacks.getService().isConnected()) {
error_msg_pane.setVisibility(View.GONE); error_msg_pane.setVisibility(View.GONE);
...@@ -188,7 +188,6 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText ...@@ -188,7 +188,6 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
contactList.addHeaderView(mHeader, null, false);
mStarredGrid.setAdapter(mGridAdapter); mStarredGrid.setAdapter(mGridAdapter);
} }
...@@ -280,21 +279,16 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText ...@@ -280,21 +279,16 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
} }
}); });
mConferenceAdapter = new CallListAdapter(getActivity(), mCallbacks.getService().get40dpContactCache(), mCallbacks.getService().getThreadPool());
mListAdapter = new ContactsAdapter(getActivity(), (HomeActivity)getActivity(), mCallbacks.getService().get40dpContactCache(), mCallbacks.getService().getThreadPool());
mGridAdapter = new StarredContactsAdapter(getActivity());
LocalService service = mCallbacks.getService();
if (service != null)
mConferenceAdapter.updateDataset(mCallbacks.getService().getConversations());
list = (ListView) inflatedView.findViewById(cx.ring.R.id.confs_list); list = (ListView) inflatedView.findViewById(cx.ring.R.id.confs_list);
list.setOnItemClickListener(callClickListener); list.setOnItemClickListener(callClickListener);
list.setOnItemLongClickListener(mItemLongClickListener); //list.setOnItemLongClickListener(mItemLongClickListener);
mHeader = (LinearLayout) inflater.inflate(R.layout.frag_contact_list_header, null); mHeader = (LinearLayout) inflater.inflate(R.layout.frag_contact_list_header, null);
contactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_stickylv); contactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_stickylv);
contactList.setDivider(null);
contactList.addHeaderView(mHeader, null, false);
mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid); mStarredGrid = (GridView) mHeader.findViewById(R.id.favorites_grid);
llMain = (LinearLayout) mHeader.findViewById(R.id.llMain); llMain = (LinearLayout) mHeader.findViewById(R.id.llMain);
favHeadLabel = (TextView) mHeader.findViewById(R.id.fav_head_label); favHeadLabel = (TextView) mHeader.findViewById(R.id.fav_head_label);
...@@ -314,11 +308,19 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText ...@@ -314,11 +308,19 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
error_msg_pane = (ViewGroup) inflatedView.findViewById(R.id.error_msg_pane); error_msg_pane = (ViewGroup) inflatedView.findViewById(R.id.error_msg_pane);
error_msg_txt = (TextView) error_msg_pane.findViewById(R.id.error_msg_txt); error_msg_txt = (TextView) error_msg_pane.findViewById(R.id.error_msg_txt);
list.setAdapter(mConferenceAdapter);
list.setVisibility(View.VISIBLE); list.setVisibility(View.VISIBLE);
contactList.setVisibility(View.GONE); contactList.setVisibility(View.GONE);
/*listSwitcher = (ViewSwitcher) inflatedView.findViewById(R.id.list_switcher);
listSwitcher.setDisplayedChild(0);*/ LocalService service = mCallbacks.getService();
if (service == null)
return inflatedView;
mConferenceAdapter = new CallListAdapter(getActivity(), service.get40dpContactCache(), service.getThreadPool());
mListAdapter = new ContactsAdapter(getActivity(), (HomeActivity)getActivity(), service.get40dpContactCache(), service.getThreadPool());
mGridAdapter = new StarredContactsAdapter(getActivity());
mConferenceAdapter.updateDataset(mCallbacks.getService().getConversations());
list.setAdapter(mConferenceAdapter);
return inflatedView; return inflatedView;
} }
......
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2004-2014 Savoir-Faire Linux Inc. Copyright (C) 2004-2015 Savoir-faire Linux Inc.
Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com> Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
...@@ -17,17 +17,6 @@ GNU General Public License for more details. ...@@ -17,17 +17,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Additional permission under GNU GPL version 3 section 7:
If you modify this program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
grants you additional permission to convey the resulting work.
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
--> -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
...@@ -43,11 +32,6 @@ as that of the covered work. ...@@ -43,11 +32,6 @@ as that of the covered work.
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ViewStub
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/viewStub" />
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar" android:id="@+id/main_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -69,6 +53,15 @@ as that of the covered work. ...@@ -69,6 +53,15 @@ as that of the covered work.
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleMarginBottom="@dimen/action_bar_title_margin_bottom" /> app:titleMarginBottom="@dimen/action_bar_title_margin_bottom" />
<FrameLayout
android:id="@+id/main_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/main_toolbar"
android:orientation="vertical" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/action_button" android:id="@+id/action_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -81,20 +74,11 @@ as that of the covered work. ...@@ -81,20 +74,11 @@ as that of the covered work.
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:adjustViewBounds="false" android:adjustViewBounds="false"
android:baselineAlignBottom="false" android:baselineAlignBottom="false"
android:elevation="4dp" android:elevation="6dp"
android:visibility="gone" android:visibility="gone"
app:elevation="4dp" app:elevation="6dp"
app:fabSize="mini" /> app:fabSize="mini" />
<FrameLayout
android:id="@+id/main_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/main_toolbar"
android:orientation="vertical" />
</RelativeLayout> </RelativeLayout>
<android.support.design.widget.NavigationView <android.support.design.widget.NavigationView
......
...@@ -23,17 +23,18 @@ along with this program; if not, write to the Free Software ...@@ -23,17 +23,18 @@ along with this program; if not, write to the Free Software
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true"> android:animateLayoutChanges="true"
tools:context=".client.HomeActivity">
<RelativeLayout <RelativeLayout
android:id="@+id/error_msg_pane"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:id="@+id/error_msg_pane" android:layout_alignParentTop="true"
android:padding="16dp"
android:background="#e57373" android:background="#e57373"
android:padding="16dp"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
...@@ -50,50 +51,49 @@ along with this program; if not, write to the Free Software ...@@ -50,50 +51,49 @@ along with this program; if not, write to the Free Software
android:id="@+id/contacts_stickylv" android:id="@+id/contacts_stickylv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/error_msg_pane"
android:background="@android:color/white"
android:clipToPadding="false" android:clipToPadding="false"
android:divider="@null" android:divider="@null"
android:drawSelectorOnTop="true" android:drawSelectorOnTop="true"
android:elevation="2dp"
android:fastScrollEnabled="true" android:fastScrollEnabled="true"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:scrollbarStyle="outsideOverlay" android:scrollbarStyle="outsideOverlay"
android:layout_alignParentLeft="true" android:visibility="gone" />
android:layout_marginLeft="0dp"
android:layout_below="@+id/error_msg_pane"
android:elevation="8dp"
android:visibility="gone"
android:background="@android:color/white" />
<ListView <ListView
android:id="@+id/confs_list" android:id="@+id/confs_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="@null"
android:paddingBottom="8dp"
android:paddingTop="8dp"
tools:listitem="@layout/item_calllist"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_below="@+id/error_msg_pane"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:layout_below="@+id/error_msg_pane"
android:elevation="8dp"
android:background="@android:color/white" android:background="@android:color/white"
android:visibility="gone" /> android:clipToPadding="false"
android:divider="@null"
android:elevation="2dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
tools:listitem="@layout/item_calllist" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/newconv_fab" android:id="@+id/newconv_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_compat_margin"
android:elevation="6dp"
android:src="@drawable/ic_add_white_24dp" android:src="@drawable/ic_add_white_24dp"
app:backgroundTint="@color/color_primary_light" app:backgroundTint="@color/color_primary_light"
app:elevation="6dp" app:elevation="6dp"
app:pressedTranslationZ="12dp" app:pressedTranslationZ="12dp"
app:rippleColor="@color/color_primary_dark" app:rippleColor="@color/color_primary_dark" />
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/fab_compat_margin" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Copyright (C) 2004-2014 Savoir-Faire Linux Inc. Copyright (C) 2004-2014 Savoir-Faire Linux Inc.
Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
...@@ -41,11 +40,12 @@ as that of the covered work. ...@@ -41,11 +40,12 @@ as that of the covered work.
android:id="@+id/contacts_stickylv" android:id="@+id/contacts_stickylv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:divider="@null"
android:drawSelectorOnTop="true" android:drawSelectorOnTop="true"
android:fastScrollEnabled="true" android:fastScrollEnabled="true"
android:scrollbarStyle="outsideOverlay" android:scrollbarStyle="outsideOverlay"
android:divider="@null" android:paddingBottom="8dp"
/> android:paddingTop="8dp" />
<TextView <TextView
android:id="@android:id/empty" android:id="@android:id/empty"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment