Search in sources :

Example 1 with AppContactFragment

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

the class MobiComKitPeopleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!MobiComUserPreference.getInstance(this).isLoggedIn()) {
        finish();
    }
    setContentView(R.layout.people_activity);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    onContactsInteractionListener = this;
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);
    // Set up the action bar.
    actionBar = getSupportActionBar();
    if (!TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimary()) && !TextUtils.isEmpty(alCustomizationSettings.getThemeColorPrimaryDark())) {
        actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(alCustomizationSettings.getThemeColorPrimary())));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor(alCustomizationSettings.getThemeColorPrimaryDark()));
        }
    }
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    intentExtra = getIntent();
    action = intentExtra.getAction();
    type = intentExtra.getType();
    if (getIntent().getExtras() != null) {
        if (Intent.ACTION_SEND.equals(action) && type != null) {
            actionBar.setTitle(getString(R.string.send_message_to));
        } else {
            actionBar.setTitle(getString(R.string.search_title));
            userIdArray = getIntent().getStringArrayExtra(USER_ID_ARRAY);
        }
    } else {
        actionBar.setTitle(getString(R.string.search_title));
    }
    appContactFragment = new AppContactFragment(userIdArray);
    appContactFragment.setAlCustomizationSettings(alCustomizationSettings);
    channelFragment = new ChannelFragment();
    setSearchListFragment(appContactFragment);
    if (alCustomizationSettings.isGroupsSectionTabHidden() || ApplozicSetting.getInstance(this).isGroupsSectionTabHidden()) {
        addFragment(this, appContactFragment, "AppContactFragment");
    } else {
        viewPager = (ViewPager) findViewById(R.id.viewPager);
        viewPager.setVisibility(View.VISIBLE);
        setupViewPager(viewPager);
        tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.setVisibility(View.VISIBLE);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.addOnTabSelectedListener(this);
    }
    // This flag notes that the Activity is doing a search, and so the result will be
    // search results rather than all contacts. This prevents the Activity and Fragment
    // from trying to a search on search results.
    isSearchResultView = true;
}
Also used : AppContactFragment(com.applozic.mobicomkit.uiwidgets.people.contact.AppContactFragment) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ColorDrawable(android.graphics.drawable.ColorDrawable) ChannelFragment(com.applozic.mobicomkit.uiwidgets.people.channel.ChannelFragment) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

ColorDrawable (android.graphics.drawable.ColorDrawable)1 Toolbar (androidx.appcompat.widget.Toolbar)1 AlCustomizationSettings (com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings)1 ChannelFragment (com.applozic.mobicomkit.uiwidgets.people.channel.ChannelFragment)1 AppContactFragment (com.applozic.mobicomkit.uiwidgets.people.contact.AppContactFragment)1