Adds actionbar in conversation activity
This commit is contained in:
parent
c29798935a
commit
a942b2f39e
|
@ -28,6 +28,7 @@ import android.support.v7.app.ActionBar;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -89,23 +90,28 @@ public class ShowConversationActivity extends AppCompatActivity implements OnRet
|
|||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
setTheme(R.style.AppTheme);
|
||||
setTheme(R.style.AppTheme_NoActionBar);
|
||||
}else {
|
||||
setTheme(R.style.AppThemeDark);
|
||||
setTheme(R.style.AppThemeDark_NoActionBar);
|
||||
}
|
||||
setContentView(R.layout.activity_show_conversation);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if( actionBar != null) {
|
||||
setContentView(R.layout.activity_hashtag);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
if( getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
if( getSupportActionBar() != null) {
|
||||
LayoutInflater inflater = (LayoutInflater) this.getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
|
||||
assert inflater != null;
|
||||
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.conversation_action_bar, null);
|
||||
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
TextView title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
|
||||
getSupportActionBar().setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||
TextView title = getSupportActionBar().getCustomView().findViewById(R.id.toolbar_title);
|
||||
pp_actionBar = getSupportActionBar().getCustomView().findViewById(R.id.pp_actionBar);
|
||||
title.setText(R.string.conversation);
|
||||
ImageView close_conversation = actionBar.getCustomView().findViewById(R.id.close_conversation);
|
||||
ImageView close_conversation = getSupportActionBar().getCustomView().findViewById(R.id.close_conversation);
|
||||
if( close_conversation != null){
|
||||
close_conversation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -115,7 +115,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@drawable/ic_edit" />
|
||||
app:srcCompat="@drawable/ic_edit"
|
||||
tools:ignore="VectorDrawableCompat" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
|
|
|
@ -1,38 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main_app_container"
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="fr.gouv.etalab.mastodon.activities.ShowConversationActivity"
|
||||
android:fitsSystemWindows="true"
|
||||
>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/lv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/loader"
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
tools:context="fr.gouv.etalab.mastodon.activities.HashTagActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
android:theme="@style/AppTheme.AppBarOverlay"
|
||||
>
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
android:theme="@style/AppThemeDark_NoActionBar"
|
||||
app:popupTheme="?attr/popupOverlay"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<!-- Framelayout to display Fragments -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main_app_container"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingLeft="@dimen/fab_margin"
|
||||
android:paddingRight="@dimen/fab_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context="fr.gouv.etalab.mastodon.activities.ShowConversationActivity"
|
||||
>
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:layout_height="match_parent">
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/lv_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="none"
|
||||
android:divider="@null" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<!-- Main Loader -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/loader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="false"
|
||||
app:headerLayout="@layout/nav_header_main"
|
||||
app:menu="@menu/activity_main_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
Loading…
Reference in New Issue