Search in sources :

Example 1 with ContactSelectionFragment

use of com.applozic.mobicomkit.uiwidgets.people.contact.ContactSelectionFragment in project Applozic-Android-SDK by AppLozic.

the class ContactSelectionActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contact_select_layout);
    contactDatabase = new ContactDatabase(this);
    contactSelectionFragment = new ContactSelectionFragment();
    setSearchListFragment(contactSelectionFragment);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    contactService = new AppContactService(this);
    mActionBar = getSupportActionBar();
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    if (!TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimary()) && !TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimaryDark())) {
        mActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(alCustomizationSettings.getThemeColorPrimary())));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor(alCustomizationSettings.getThemeColorPrimaryDark()));
        }
    }
    mActionBar.setDisplayShowHomeEnabled(true);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    if (getIntent().getExtras() != null) {
        channel = (Channel) getIntent().getSerializableExtra(CHANNEL_OBJECT);
        disableCheckBox = getIntent().getBooleanExtra(CHECK_BOX, false);
        mActionBar.setTitle(R.string.channel_member_title);
        name = getIntent().getStringExtra(CHANNEL);
        imageUrl = getIntent().getStringExtra(IMAGE_LINK);
        groupType = getIntent().getIntExtra(GROUP_TYPE, Channel.GroupType.PUBLIC.getValue().intValue());
    } else {
        mActionBar.setTitle(R.string.channel_members_title);
    }
    Bundle bundle = new Bundle();
    bundle.putSerializable(CHANNEL_OBJECT, channel);
    bundle.putBoolean(CHECK_BOX, disableCheckBox);
    bundle.putString(CHANNEL, name);
    bundle.putString(IMAGE_LINK, imageUrl);
    bundle.putInt(GROUP_TYPE, groupType);
    contactSelectionFragment.setArguments(bundle);
    addFragment(this, contactSelectionFragment, "ContactSelectionFragment");
    connectivityReceiver = new ConnectivityReceiver();
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) AppContactService(com.applozic.mobicomkit.contact.AppContactService) ColorDrawable(android.graphics.drawable.ColorDrawable) Bundle(android.os.Bundle) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) ContactSelectionFragment(com.applozic.mobicomkit.uiwidgets.people.contact.ContactSelectionFragment) ContactDatabase(com.applozic.mobicomkit.contact.database.ContactDatabase) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

IntentFilter (android.content.IntentFilter)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Bundle (android.os.Bundle)1 Toolbar (android.support.v7.widget.Toolbar)1 ConnectivityReceiver (com.applozic.mobicomkit.broadcast.ConnectivityReceiver)1 AppContactService (com.applozic.mobicomkit.contact.AppContactService)1 ContactDatabase (com.applozic.mobicomkit.contact.database.ContactDatabase)1 AlCustomizationSettings (com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings)1 ContactSelectionFragment (com.applozic.mobicomkit.uiwidgets.people.contact.ContactSelectionFragment)1