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);
}
}
}
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);
}
}
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);
}
}
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);
}
});
}
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();
}
}
}
Aggregations