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

menu: avoid nesting fragments

Tuleap: #468
Change-Id: I73f61fcf75e32f80074f390a5334a8d0cdda455a
parent b987af12
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,10 @@
public <init>(android.content.Context);
}
-keepattributes Signature
-keep class android.support.v7.widget.LinearLayoutManager { *; }
-keep class cx.ring.service.**
-keepclassmembers class cx.ring.service.** { *; }
......
......@@ -399,7 +399,7 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call
/**
* Defines callbacks for service binding, passed to bindService()
*/
private ServiceConnection mConnection = new ServiceConnection() {
private final ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder s) {
......@@ -410,39 +410,37 @@ public class HomeActivity extends AppCompatActivity implements LocalService.Call
intentFilter.addAction(LocalService.ACTION_CONF_UPDATE);
intentFilter.addAction(LocalService.ACTION_ACCOUNT_UPDATE);
registerReceiver(receiver, intentFilter);
mBound = true;
fContent = new CallListFragment();
if (fMenuHead != null)
fMenu.removeHeaderView(fMenuHead.getView());
fMenu.inflateHeaderView(R.layout.menuheader);
fMenuHead = (MenuFragment) getFragmentManager().findFragmentById(R.id.accountselector);
FragmentManager fm = getFragmentManager();
fMenuHead = (MenuFragment) fm.findFragmentById(R.id.menu_head);
if (fMenuHead == null) {
fMenuHead = new MenuFragment();
getFragmentManager().beginTransaction().replace(R.id.menu_head, fMenuHead).commitAllowingStateLoss();
}
fContent = getFragmentManager().findFragmentById(R.id.main_frame);
if (fContent == null) {
fContent = new CallListFragment();
getFragmentManager().beginTransaction().replace(R.id.main_frame, fContent, "Home").addToBackStack("Home").commitAllowingStateLoss();
mBound = true;
Log.i(TAG, "Service connected service=" + service);
}
}
@Override
public void onServiceDisconnected(ComponentName className) {
Log.i(TAG, "onServiceConnected " + className.getClassName());
if (fMenuHead != null) {
fMenu.removeHeaderView(fMenuHead.getView());
getFragmentManager().beginTransaction().remove(fMenuHead).commitAllowingStateLoss();
fMenuHead = null;
}
mBound = false;
Log.i(TAG, "Service disconnected service=" + service);
}
};
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
return false;
return mDrawerToggle.onOptionsItemSelected(item);
}
@Override
......
......@@ -69,14 +69,14 @@ along with this program; if not, write to the Free Software
android:layout_alignParentStart="true"
android:layout_marginBottom="@dimen/action_button_bpadding"
android:layout_marginLeft="@dimen/action_button_lpadding"
android:layout_marginStart="@dimen/action_button_lpadding"
android:adjustViewBounds="false"
android:baselineAlignBottom="false"
android:visibility="gone"
app:elevation="6dp"
app:fabSize="mini"
app:pressedTranslationZ="12dp"
app:rippleColor="@android:color/white"
android:layout_marginStart="@dimen/action_button_lpadding"
android:visibility="gone" />
app:rippleColor="@android:color/white" />
</RelativeLayout>
......@@ -88,6 +88,7 @@ along with this program; if not, write to the Free Software
android:fitsSystemWindows="true"
android:theme="@style/AppThemeBase"
android:windowBackground="@color/white"
app:headerLayout="@layout/menuheader"
app:itemTextColor="?android:textColorPrimary"
app:menu="@menu/drawer" />
......
......@@ -79,7 +79,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:layout_below="@+id/contact_bubble"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_color_primary_dark" />
android:textColor="@color/text_color_primary_dark"
android:singleLine="true" />
<TextView
android:id="@+id/contact_bubble_num_txt"
......@@ -152,7 +153,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:rippleColor="@android:color/white"
android:layout_gravity="bottom|center_horizontal" />
android:layout_gravity="bottom|center_horizontal"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/call_status_bar"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/accountselector"
android:name="cx.ring.fragments.MenuFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/frag_menu_header" />
</LinearLayout>
\ No newline at end of file
android:orientation="vertical"
android:id="@+id/menu_head">
</FrameLayout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment