mirror of
				https://github.com/pierre42100/ComunicAndroid
				synced 2025-11-04 11:34:06 +00:00 
			
		
		
		
	Created new navbar
This commit is contained in:
		@@ -91,11 +91,6 @@ public class MainActivity extends AppCompatActivity implements
 | 
			
		||||
     */
 | 
			
		||||
    private ConversationsListHelper conversationsListHelper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Bottom navigation view
 | 
			
		||||
     */
 | 
			
		||||
    private DrawerLayout mDrawer;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
        super.onCreate(savedInstanceState);
 | 
			
		||||
@@ -197,12 +192,6 @@ public class MainActivity extends AppCompatActivity implements
 | 
			
		||||
        //Get action id
 | 
			
		||||
        int id = item.getItemId();
 | 
			
		||||
 | 
			
		||||
        //To toggle drawer
 | 
			
		||||
        if (id == android.R.id.home) {
 | 
			
		||||
            toggleDrawer();
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //To search a user
 | 
			
		||||
        if (id == R.id.action_search_user) {
 | 
			
		||||
            searchUser();
 | 
			
		||||
@@ -241,65 +230,10 @@ public class MainActivity extends AppCompatActivity implements
 | 
			
		||||
     */
 | 
			
		||||
    void init_drawer() {
 | 
			
		||||
 | 
			
		||||
        assert getSupportActionBar() != null;
 | 
			
		||||
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 | 
			
		||||
       //TODO : remove
 | 
			
		||||
 | 
			
		||||
        mDrawer = findViewById(R.id.drawer_layout);
 | 
			
		||||
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
 | 
			
		||||
                this, mDrawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
 | 
			
		||||
        mDrawer.addDrawerListener(toggle);
 | 
			
		||||
        toggle.syncState();
 | 
			
		||||
 | 
			
		||||
        NavigationView navigationView = findViewById(R.id.nav_view);
 | 
			
		||||
        navigationView.setNavigationItemSelectedListener(this);
 | 
			
		||||
 | 
			
		||||
        //Get information about the user
 | 
			
		||||
        new Thread(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                final UserInfo info = new GetUsersHelper(getApplicationContext()).getSingle(
 | 
			
		||||
                        new AccountUtils(getApplicationContext()).get_current_user_id(), false);
 | 
			
		||||
 | 
			
		||||
                //Apply user information
 | 
			
		||||
                if(mDrawer != null){
 | 
			
		||||
                    mDrawer.post(new Runnable() {
 | 
			
		||||
                        @Override
 | 
			
		||||
                        public void run() {
 | 
			
		||||
                            applyUserInfoInDrawer(info);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }).start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Apply current user information in the drawer
 | 
			
		||||
     *
 | 
			
		||||
     * @param info Information about the user to apply
 | 
			
		||||
     */
 | 
			
		||||
    private void applyUserInfoInDrawer(@Nullable UserInfo info){
 | 
			
		||||
 | 
			
		||||
        //Check for errors
 | 
			
		||||
        if(info == null){
 | 
			
		||||
            Toast.makeText(MainActivity.this, R.string.err_get_user_info,
 | 
			
		||||
                    Toast.LENGTH_SHORT).show();
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Apply user information
 | 
			
		||||
        ((TextView)findViewById(R.id.current_user_name)).setText(info.getDisplayFullName());
 | 
			
		||||
        ((WebUserAccountImage)findViewById(R.id.current_user_account_image)).setUser(info);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onBackPressed() {
 | 
			
		||||
        if (mDrawer.isDrawerOpen(GravityCompat.START)) {
 | 
			
		||||
            mDrawer.closeDrawer(GravityCompat.START);
 | 
			
		||||
        } else {
 | 
			
		||||
            super.onBackPressed();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
 | 
			
		||||
@@ -330,21 +264,10 @@ public class MainActivity extends AppCompatActivity implements
 | 
			
		||||
            openConversationsListFragment();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        mDrawer.closeDrawer(GravityCompat.START);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Toggle drawer state
 | 
			
		||||
     */
 | 
			
		||||
    void toggleDrawer(){
 | 
			
		||||
        if (mDrawer.isDrawerOpen(GravityCompat.START)) {
 | 
			
		||||
            mDrawer.closeDrawer(GravityCompat.START);
 | 
			
		||||
        } else {
 | 
			
		||||
            mDrawer.openDrawer(GravityCompat.START);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
package org.communiquons.android.comunic.client.ui.utils;
 | 
			
		||||
 | 
			
		||||
import android.graphics.drawable.Drawable;
 | 
			
		||||
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Drawable utilities
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
public class DrawableUtils {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Duplicate a {@link Drawable} object
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @param source The drawable to duplicate
 | 
			
		||||
     * @return Generated drawable copy
 | 
			
		||||
     */
 | 
			
		||||
    public static Drawable DuplicateDrawable(Drawable source){
 | 
			
		||||
        return Objects.requireNonNull(source.getConstantState()).newDrawable().mutate();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,51 @@
 | 
			
		||||
package org.communiquons.android.comunic.client.ui.views;
 | 
			
		||||
 | 
			
		||||
import android.app.Activity;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.ContextWrapper;
 | 
			
		||||
import android.support.annotation.NonNull;
 | 
			
		||||
import android.support.annotation.Nullable;
 | 
			
		||||
import android.util.AttributeSet;
 | 
			
		||||
import android.widget.FrameLayout;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base extensible FrameLayoutView
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
abstract class BaseFrameLayoutView extends FrameLayout {
 | 
			
		||||
 | 
			
		||||
    public BaseFrameLayoutView(@NonNull Context context) {
 | 
			
		||||
        super(context);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public BaseFrameLayoutView(@NonNull Context context, @Nullable AttributeSet attrs) {
 | 
			
		||||
        super(context, attrs);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public BaseFrameLayoutView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
 | 
			
		||||
        super(context, attrs, defStyleAttr);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public BaseFrameLayoutView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
 | 
			
		||||
        super(context, attrs, defStyleAttr, defStyleRes);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get hosting activity
 | 
			
		||||
     *
 | 
			
		||||
     * @return Hosting activity, if found, null else
 | 
			
		||||
     */
 | 
			
		||||
    protected Activity getActivity(){
 | 
			
		||||
        Context context = getContext();
 | 
			
		||||
 | 
			
		||||
        while(context instanceof ContextWrapper){
 | 
			
		||||
            if(context instanceof Activity)
 | 
			
		||||
                return (Activity)context;
 | 
			
		||||
 | 
			
		||||
            context = ((ContextWrapper)context).getBaseContext();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,79 @@
 | 
			
		||||
package org.communiquons.android.comunic.client.ui.views;
 | 
			
		||||
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.support.annotation.NonNull;
 | 
			
		||||
import android.support.annotation.Nullable;
 | 
			
		||||
import android.util.AttributeSet;
 | 
			
		||||
import android.view.Menu;
 | 
			
		||||
import android.view.MenuItem;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.view.ViewGroup;
 | 
			
		||||
import android.widget.LinearLayout;
 | 
			
		||||
import android.widget.PopupMenu;
 | 
			
		||||
 | 
			
		||||
import org.communiquons.android.comunic.client.R;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Application navigation bar
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
public class NavigationBar extends BaseFrameLayoutView {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Navigation bar items container
 | 
			
		||||
     */
 | 
			
		||||
    private LinearLayout mLinearLayout;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Popup mMenu used to inflate mMenu
 | 
			
		||||
     */
 | 
			
		||||
    private PopupMenu mPopupMenu;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Associated mMenu
 | 
			
		||||
     */
 | 
			
		||||
    private Menu mMenu;
 | 
			
		||||
 | 
			
		||||
    public NavigationBar(@NonNull Context context) {
 | 
			
		||||
        super(context);
 | 
			
		||||
        init();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NavigationBar(@NonNull Context context, @Nullable AttributeSet attrs) {
 | 
			
		||||
        super(context, attrs);
 | 
			
		||||
        init();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NavigationBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
 | 
			
		||||
        super(context, attrs, defStyleAttr);
 | 
			
		||||
        init();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize view
 | 
			
		||||
     */
 | 
			
		||||
    private void init(){
 | 
			
		||||
 | 
			
		||||
        //Inflate main view
 | 
			
		||||
        View view = inflate(getContext(), R.layout.navigation_bar, this);
 | 
			
		||||
        mLinearLayout = view.findViewById(R.id.container);
 | 
			
		||||
 | 
			
		||||
        //Process mMenu
 | 
			
		||||
        mPopupMenu = new PopupMenu(getContext(), null);
 | 
			
		||||
        mMenu = mPopupMenu.getMenu();
 | 
			
		||||
        getActivity().getMenuInflater().inflate(R.menu.navigation_bar, mMenu);
 | 
			
		||||
 | 
			
		||||
        for(int i = 0; i < mMenu.size(); i++){
 | 
			
		||||
 | 
			
		||||
            //Inflate view
 | 
			
		||||
            NavigationBarItem itemView = new NavigationBarItem(getContext());
 | 
			
		||||
            mLinearLayout.addView(itemView,
 | 
			
		||||
                    new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1f));
 | 
			
		||||
 | 
			
		||||
            MenuItem item = mMenu.getItem(i);
 | 
			
		||||
 | 
			
		||||
            itemView.setIconDrawable(item.getIcon());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
package org.communiquons.android.comunic.client.ui.views;
 | 
			
		||||
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.graphics.PorterDuff;
 | 
			
		||||
import android.graphics.drawable.Drawable;
 | 
			
		||||
import android.support.annotation.NonNull;
 | 
			
		||||
import android.util.Log;
 | 
			
		||||
import android.view.MotionEvent;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.ImageView;
 | 
			
		||||
 | 
			
		||||
import org.communiquons.android.comunic.client.R;
 | 
			
		||||
import org.communiquons.android.comunic.client.ui.utils.DrawableUtils;
 | 
			
		||||
import org.communiquons.android.comunic.client.ui.utils.UiUtils;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Navigation bar item view
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
class NavigationBarItem extends BaseFrameLayoutView {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Debug tag
 | 
			
		||||
     */
 | 
			
		||||
    private static final String TAG = NavigationBarItem.class.getCanonicalName();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Image icon
 | 
			
		||||
     */
 | 
			
		||||
    private ImageView mIcon;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Source drawable
 | 
			
		||||
     */
 | 
			
		||||
    private Drawable mSrcDrawable;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selected state of the drawable
 | 
			
		||||
     */
 | 
			
		||||
    private boolean mSelected;
 | 
			
		||||
 | 
			
		||||
    public NavigationBarItem(@NonNull Context context) {
 | 
			
		||||
        super(context);
 | 
			
		||||
 | 
			
		||||
        //Inflate view
 | 
			
		||||
        View view = inflate(getContext(), R.layout.navigation_bar_item, this);
 | 
			
		||||
        mIcon = view.findViewById(R.id.icon);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set item icon drawable
 | 
			
		||||
     *
 | 
			
		||||
     * @param iconDrawable The drawable to apply
 | 
			
		||||
     */
 | 
			
		||||
    public void setIconDrawable(Drawable iconDrawable){
 | 
			
		||||
        mSrcDrawable = iconDrawable;
 | 
			
		||||
        draw();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Draw (refresh) the view
 | 
			
		||||
     */
 | 
			
		||||
    public void draw(){
 | 
			
		||||
        Drawable drawable = DrawableUtils.DuplicateDrawable(mSrcDrawable);
 | 
			
		||||
 | 
			
		||||
        int color = isSelected() ? R.color.navbar_selected : R.color.navbar_default;
 | 
			
		||||
        drawable.setColorFilter(UiUtils.getColor(getContext(), color), PorterDuff.Mode.SRC_IN);
 | 
			
		||||
 | 
			
		||||
        mIcon.setImageDrawable(drawable);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isSelected() {
 | 
			
		||||
        return mSelected;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSelected(boolean selected) {
 | 
			
		||||
        this.mSelected = selected;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:width="640dp"
 | 
			
		||||
    android:height="512dp"
 | 
			
		||||
    android:viewportWidth="640.0"
 | 
			
		||||
    android:viewportHeight="512.0">
 | 
			
		||||
    android:width="2048dp"
 | 
			
		||||
    android:height="1792dp"
 | 
			
		||||
    android:viewportWidth="2048.0"
 | 
			
		||||
    android:viewportHeight="1792.0">
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#000000"
 | 
			
		||||
        android:pathData="M192 256c61.9 0 112-50.1 112-112S253.9 32 192 32 80 82.1 80 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C51.6 288 0 339.6 0 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zM480 256c53 0 96-43 96-96s-43-96-96-96-96 43-96 96 43 96 96 96zm48 32h-3.8c-13.9 4.8-28.6 8-44.2 8s-30.3-3.2-44.2-8H432c-20.4 0-39.2 5.9-55.7 15.4 24.4 26.3 39.7 61.2 39.7 99.8v38.4c0 2.2-0.5 4.3-0.6 6.4H592c26.5 0 48-21.5 48-48 0-61.9-50.1-112-112-112z"/>
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M657 896q-162 5-265 128h-134q-82 0-138-40.5t-56-118.5q0-353 124-353 6 0 43.5 21t97.5 42.5 119 21.5q67 0 133-23-5 37-5 66 0 139 81 256zm1071 637q0 120-73 189.5t-194 69.5h-874q-121 0-194-69.5t-73-189.5q0-53 3.5-103.5t14-109 26.5-108.5 43-97.5 62-81 85.5-53.5 111.5-20q10 0 43 21.5t73 48 107 48 135 21.5 135-21.5 107-48 73-48 43-21.5q61 0 111.5 20t85.5 53.5 62 81 43 97.5 26.5 108.5 14 109 3.5 103.5zm-1024-1277q0 106-75 181t-181 75-181-75-75-181 75-181 181-75 181 75 75 181zm704 384q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5zm576 225q0 78-56 118.5t-138 40.5h-134q-103-123-265-128 81-117 81-256 0-29-5-66 66 23 133 23 59 0 119-21.5t97.5-42.5 43.5-21q124 0 124 353zm-128-609q0 106-75 181t-181 75-181-75-75-181 75-181 181-75 181 75 75 181z"/>
 | 
			
		||||
</vector>
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,6 @@
 | 
			
		||||
    android:viewportWidth="24.0"
 | 
			
		||||
    android:viewportHeight="24.0">
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#FF000000"
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>
 | 
			
		||||
</vector>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    android:viewportWidth="48.0">
 | 
			
		||||
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#FF000000"
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M20 40V28h8v12h10V24h6L24 6 4 24h6v16z" />
 | 
			
		||||
 | 
			
		||||
</vector>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    android:viewportWidth="24.0">
 | 
			
		||||
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#FF000000"
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M12 22c1.1 0 2-0.9 2-2h-4c0 1.1 0.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-0.83-0.67-1.5-1.5-1.5s-1.5 0.67-1.5 1.5v 0.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" />
 | 
			
		||||
 | 
			
		||||
</vector>
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,6 @@
 | 
			
		||||
    android:viewportHeight="24.0"
 | 
			
		||||
    android:viewportWidth="24.0">
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#FF000000"
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-0.25 1.97,-0.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z" />
 | 
			
		||||
</vector>
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:width="448dp"
 | 
			
		||||
    android:height="512dp"
 | 
			
		||||
    android:viewportWidth="448.0"
 | 
			
		||||
    android:viewportHeight="512.0">
 | 
			
		||||
    android:width="48dp"
 | 
			
		||||
    android:height="48dp"
 | 
			
		||||
    android:viewportWidth="1792.0"
 | 
			
		||||
    android:viewportHeight="1792.0">
 | 
			
		||||
    <path
 | 
			
		||||
        android:fillColor="#000000"
 | 
			
		||||
        android:pathData="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"/>
 | 
			
		||||
        android:fillColor="@color/default_drawable_color"
 | 
			
		||||
        android:pathData="M1536 1399q0 109-62.5 187t-150.5 78h-854q-88 0-150.5-78t-62.5-187q0-85 8.5-160.5t31.5-152 58.5-131 94-89 134.5-34.5q131 128 313 128t313-128q76 0 134.5 34.5t94 89 58.5 131 31.5 152 8.5 160.5zm-256-887q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5z"/>
 | 
			
		||||
</vector>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								app/src/main/res/drawable/navbar_item_ripple_effect.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/src/main/res/drawable/navbar_item_ripple_effect.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
    android:color="@android:color/white"
 | 
			
		||||
    tools:targetApi="lollipop">
 | 
			
		||||
    <item android:id="@android:id/mask">
 | 
			
		||||
        <shape android:shape="rectangle">
 | 
			
		||||
            <solid android:color="@android:color/white" />
 | 
			
		||||
        </shape>
 | 
			
		||||
    </item>
 | 
			
		||||
</ripple>
 | 
			
		||||
@@ -1,34 +1,18 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<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:id="@+id/drawer_layout"
 | 
			
		||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="match_parent"
 | 
			
		||||
    android:fitsSystemWindows="false"
 | 
			
		||||
    tools:openDrawer="start">
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <android.support.design.widget.CoordinatorLayout
 | 
			
		||||
    <org.communiquons.android.comunic.client.ui.views.NavigationBar
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        tools:context=".MainActivity">
 | 
			
		||||
        android:layout_height="wrap_content" />
 | 
			
		||||
 | 
			
		||||
        <FrameLayout
 | 
			
		||||
            android:id="@+id/main_fragment"
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
            android:layout_height="match_parent"
 | 
			
		||||
            android:layout_weight="2" />
 | 
			
		||||
    <!-- Page frame -->
 | 
			
		||||
    <FrameLayout
 | 
			
		||||
        android:id="@+id/main_fragment"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:layout_weight="2" />
 | 
			
		||||
 | 
			
		||||
    </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="true"
 | 
			
		||||
        app:headerLayout="@layout/nav_header_main"
 | 
			
		||||
        app:menu="@menu/activity_main_drawer" />
 | 
			
		||||
 | 
			
		||||
</android.support.v4.widget.DrawerLayout>
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
							
								
								
									
										10
									
								
								app/src/main/res/layout/navigation_bar.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app/src/main/res/layout/navigation_bar.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<LinearLayout
 | 
			
		||||
    android:id="@+id/container"
 | 
			
		||||
    xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="40dp"
 | 
			
		||||
    android:background="@color/colorPrimary"
 | 
			
		||||
    android:orientation="horizontal">
 | 
			
		||||
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
							
								
								
									
										25
									
								
								app/src/main/res/layout/navigation_bar_item.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								app/src/main/res/layout/navigation_bar_item.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
			
		||||
    android:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="match_parent"
 | 
			
		||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
			
		||||
    android:background="@drawable/navbar_item_ripple_effect"
 | 
			
		||||
    android:clickable="true"
 | 
			
		||||
    android:focusable="true">
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/icon"
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="@dimen/nav_bar_ic_height"
 | 
			
		||||
        android:layout_marginBottom="8dp"
 | 
			
		||||
        android:layout_marginEnd="8dp"
 | 
			
		||||
        android:layout_marginStart="8dp"
 | 
			
		||||
        android:layout_marginTop="8dp"
 | 
			
		||||
        tools:src="@drawable/ic_menu_home"
 | 
			
		||||
        app:layout_constraintBottom_toBottomOf="parent"
 | 
			
		||||
        app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="parent" />
 | 
			
		||||
 | 
			
		||||
</android.support.constraint.ConstraintLayout>
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
    <item
 | 
			
		||||
        android:id="@+id/action_latest_posts"
 | 
			
		||||
        android:title="@string/action_latest_posts"
 | 
			
		||||
        android:icon="@drawable/ic_sync_black_24dp" />
 | 
			
		||||
        android:icon="@drawable/ic_sync" />
 | 
			
		||||
 | 
			
		||||
    <item
 | 
			
		||||
        android:id="@+id/action_conversations"
 | 
			
		||||
@@ -9,6 +9,12 @@
 | 
			
		||||
    <color name="darker_darker_gray">#5b5b5b</color>
 | 
			
		||||
    <color name="dark_blue">#303f9f</color>
 | 
			
		||||
 | 
			
		||||
    <color name="default_drawable_color">#000000</color>
 | 
			
		||||
 | 
			
		||||
    <!-- Navigation bar -->
 | 
			
		||||
    <color name="navbar_default">#FFFFFF</color>
 | 
			
		||||
    <color name="navbar_selected">@color/colorPrimary</color>
 | 
			
		||||
 | 
			
		||||
    <!-- Conversation messages -->
 | 
			
		||||
    <color name="conversation_user_messages_background">#3F51B5</color>
 | 
			
		||||
    <color name="conversation_user_messages_textColor">#FFFFFF</color>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,4 +29,7 @@
 | 
			
		||||
    <!-- Dimensions for the comments options button -->
 | 
			
		||||
    <dimen name="comment_options_btn_width">20dp</dimen>
 | 
			
		||||
    <dimen name="comment_options_btn_height">20dp</dimen>
 | 
			
		||||
 | 
			
		||||
    <!-- Navigation bar -->
 | 
			
		||||
    <dimen name="nav_bar_ic_height">30dp</dimen>
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user