Search in sources :

Example 41 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project ChatExchange by HueToYou.

the class HueUtils method setAddChatFabColorDefault.

public void setAddChatFabColorDefault(AppCompatActivity activity) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (activity != null) {
        FloatingActionButton addChat = (FloatingActionButton) activity.findViewById(R.id.add_chat_fab);
        if (addChat != null) {
            int initialColor = mSharedPreferences.getInt("default_color", 0xFF000000);
            ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] { android.R.attr.state_enabled } }, new int[] { initialColor });
            addChat.setBackgroundTintList(colorStateList);
        }
    }
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) ColorStateList(android.content.res.ColorStateList)

Example 42 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project ChatExchange by HueToYou.

the class HueUtils method setAddChatFabColor.

public void setAddChatFabColor(AppCompatActivity activity, @ColorInt int appBarColor) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    FloatingActionButton addChat = (FloatingActionButton) activity.findViewById(R.id.add_chat_fab);
    if (addChat != null) {
        ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] { android.R.attr.state_enabled } }, new int[] { appBarColor });
        addChat.setBackgroundTintList(colorStateList);
    }
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) ColorStateList(android.content.res.ColorStateList)

Example 43 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project ChatExchange by HueToYou.

the class HueUtils method setChatFragmentFabColorDefault.

public void setChatFragmentFabColorDefault(AppCompatActivity activity) {
    if (mSharedPreferences == null) {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }
    if (activity != null) {
        FloatingActionButton closeChat = (FloatingActionButton) activity.findViewById(R.id.close_chat_frag);
        FloatingActionButton openBrowser = (FloatingActionButton) activity.findViewById(R.id.open_in_browser_fab);
        FloatingActionButton showUsers = (FloatingActionButton) activity.findViewById(R.id.show_users_fab);
        int initialColor = mSharedPreferences.getInt("default_color", 0xFF000000);
        ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] { android.R.attr.state_enabled } }, new int[] { initialColor });
        closeChat.setBackgroundTintMode(PorterDuff.Mode.MULTIPLY);
        closeChat.setBackgroundTintList(colorStateList);
        openBrowser.setBackgroundTintMode(PorterDuff.Mode.MULTIPLY);
        openBrowser.setBackgroundTintList(colorStateList);
        showUsers.setBackgroundTintMode(PorterDuff.Mode.MULTIPLY);
        showUsers.setBackgroundTintList(colorStateList);
    }
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) ColorStateList(android.content.res.ColorStateList)

Example 44 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project ChatExchange by HueToYou.

the class ChatFragment method addChatButtons.

private void addChatButtons(final String url) {
    FloatingActionButton showUsers = (FloatingActionButton) view.findViewById(R.id.show_users_fab);
    FloatingActionButton openInBrowser = (FloatingActionButton) view.findViewById(R.id.open_in_browser_fab);
    showUsers.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mSlidingMenu.toggle();
        }
    });
    openInBrowser.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(browserIntent);
        }
    });
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) Intent(android.content.Intent) View(android.view.View)

Example 45 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project ChatExchange by HueToYou.

the class MainActivity method setup.

private void setup() {
    mTabLayout = (TabLayout) findViewById(R.id.main_tabs);
    try {
        TabLayout.Tab home = mTabLayout.newTab().setText(getResources().getText(R.string.generic_accounts)).setIcon(new BitmapDrawable(Resources.getSystem(), Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher), 144, 144, true))).setTag("home");
        //            TabLayout.Tab add = mTabLayout.newTab()
        //                    .setText(getResources()
        //                            .getText(R.string.activity_main_add_chat))
        //                    .setIcon(new BitmapDrawable(Resources.getSystem(), Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher), 144, 144, true)))
        //                    .setTag("add");
        //            mTabLayout.addTab(add);
        mTabLayout.addTab(home);
    //            home.select();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.add_chat_fab);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showAddTabDialog();
        }
    });
    HandleAdds handleAdds = new HandleAdds();
    CancelTask cancel = new CancelTask(handleAdds);
    mHandler.postDelayed(cancel, 10000);
    handleAdds.execute();
    mAccountManager = AccountManager.get(this);
    if (mAccountManager.getAccounts().length > 0) {
        //            int tabIndex = mSharedPrefs.getInt("tabIndex", 0);
        addFragmentByTab(mTabLayout.getTabAt(HOME_INDEX));
    } else {
        startActivity(new Intent(this, AuthenticatorActivity.class));
        finish();
    }
    tabListener();
    if (mAddTab != null && mIntent != null && mIntent.getAction() != null) {
        final String action = mIntent.getAction();
        if (action.equals(Intent.ACTION_MAIN)) {
            ReAddTabs reAddTabs = new ReAddTabs();
            CancelTask cancelTask = new CancelTask(reAddTabs);
            mHandler.postDelayed(cancelTask, 10000);
            reAddTabs.execute();
        }
    }
}
Also used : Intent(android.content.Intent) BitmapDrawable(android.graphics.drawable.BitmapDrawable) View(android.view.View) AuthenticatorActivity(com.huetoyou.chatexchange.auth.AuthenticatorActivity) TabLayout(android.support.design.widget.TabLayout) FloatingActionButton(android.support.design.widget.FloatingActionButton)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)79 View (android.view.View)56 Toolbar (android.support.v7.widget.Toolbar)29 TextView (android.widget.TextView)18 ImageView (android.widget.ImageView)15 Intent (android.content.Intent)12 RecyclerView (android.support.v7.widget.RecyclerView)11 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 ColorStateList (android.content.res.ColorStateList)8 Bundle (android.os.Bundle)8 NavigationView (android.support.design.widget.NavigationView)8 TabLayout (android.support.design.widget.TabLayout)8 ViewPager (android.support.v4.view.ViewPager)8 ActionBar (android.support.v7.app.ActionBar)7 UiController (android.support.test.espresso.UiController)6 ViewAction (android.support.test.espresso.ViewAction)6 AdapterView (android.widget.AdapterView)6 DrawerLayout (android.support.v4.widget.DrawerLayout)4 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)4 MenuItem (android.view.MenuItem)4