Search in sources :

Example 1 with AlCustomizationSettings

use of com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String jsonString = FileUtils.loadSettingsJsonFile(getActivity().getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    applozicDocumentView = new ApplozicDocumentView(getContext());
    restrictedWords = FileUtils.loadRestrictedWordsFile(getContext());
    conversationUIService = new ConversationUIService(getActivity());
    syncCallService = SyncCallService.getInstance(getActivity());
    appContactService = new AppContactService(getActivity());
    messageDatabaseService = new MessageDatabaseService(getActivity());
    fileClientService = new FileClientService(getActivity());
    setHasOptionsMenu(true);
    imageThumbnailLoader = new ImageLoader(getContext(), ImageUtils.getLargestScreenDimension((Activity) getContext())) {

        @Override
        protected Bitmap processBitmap(Object data) {
            return fileClientService.loadThumbnailImage(getContext(), (Message) data, getImageLayoutParam(false).width, getImageLayoutParam(false).height);
        }
    };
    imageCache = ImageCache.getInstance((getActivity()).getSupportFragmentManager(), 0.1f);
    imageThumbnailLoader.setImageFadeIn(false);
    imageThumbnailLoader.addImageCache((getActivity()).getSupportFragmentManager(), 0.1f);
    messageImageLoader = new ImageLoader(getContext(), ImageUtils.getLargestScreenDimension((Activity) getContext())) {

        @Override
        protected Bitmap processBitmap(Object data) {
            return fileClientService.loadMessageImage(getContext(), (String) data);
        }
    };
    messageImageLoader.setImageFadeIn(false);
    messageImageLoader.addImageCache((getActivity()).getSupportFragmentManager(), 0.1f);
    applozicAudioRecordManager = new ApplozicAudioRecordManager(getActivity());
    mDetector = new GestureDetectorCompat(getContext(), this);
}
Also used : AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ConversationUIService(com.applozic.mobicomkit.uiwidgets.conversation.ConversationUIService) AppContactService(com.applozic.mobicomkit.contact.AppContactService) Message(com.applozic.mobicomkit.api.conversation.Message) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) Bitmap(android.graphics.Bitmap) ImageLoader(com.applozic.mobicommons.commons.image.ImageLoader) ApplozicDocumentView(com.applozic.mobicomkit.uiwidgets.attachmentview.ApplozicDocumentView) MessageDatabaseService(com.applozic.mobicomkit.api.conversation.database.MessageDatabaseService) ApplozicAudioRecordManager(com.applozic.mobicomkit.uiwidgets.attachmentview.ApplozicAudioRecordManager)

Example 2 with AlCustomizationSettings

use of com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings 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.isStartNewGroup()) {
        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);
    } else {
        addFragment(this, appContactFragment, "AppContactFragment");
    }
    /*  mContactsListFragment = (AppContactFragment)
                getSupportFragmentManager().findFragmentById(R.id.contact_list);*/
    // 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;
    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
// Set special title for search results
/*  if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            mContactsListFragment.onQueryTextChange(searchQuery);
        }*/
}
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) Intent(android.content.Intent) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with AlCustomizationSettings

use of com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings 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)

Example 4 with AlCustomizationSettings

use of com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings in project Applozic-Android-SDK by AppLozic.

the class ConversationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    if (!TextUtils.isEmpty(alCustomizationSettings.getChatBackgroundImageName())) {
        resourceId = getResources().getIdentifier(alCustomizationSettings.getChatBackgroundImageName(), "drawable", getPackageName());
    }
    if (resourceId != 0) {
        getWindow().setBackgroundDrawableResource(resourceId);
    }
    setContentView(R.layout.quickconversion_activity);
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);
    baseContactService = new AppContactService(this);
    conversationUIService = new ConversationUIService(this);
    mobiComMessageService = new MobiComMessageService(this, MessageIntentService.class);
    quickConversationFragment = new MobiComQuickConversationFragment();
    connectivityReceiver = new ConnectivityReceiver();
    geoApiKey = Utils.getMetaDataValue(getApplicationContext(), GOOGLE_API_KEY_META_DATA);
    activityToOpenOnClickOfCallButton = Utils.getMetaDataValue(getApplicationContext(), ACTIVITY_TO_OPEN_ONCLICK_OF_CALL_BUTTON_META_DATA);
    layout = (LinearLayout) findViewById(R.id.footerAd);
    applozicPermission = new ApplozicPermissions(this, layout);
    childFragmentLayout = (RelativeLayout) findViewById(R.id.layout_child_activity);
    profilefragment = new ProfileFragment();
    profilefragment.setAlCustomizationSettings(alCustomizationSettings);
    contactsGroupId = MobiComUserPreference.getInstance(this).getContactsGroupId();
    if (Utils.hasMarshmallow()) {
        applozicPermission.checkRuntimePermissionForStorage();
    }
    mActionBar = getSupportActionBar();
    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()));
        }
    }
    inviteMessage = Utils.getMetaDataValue(getApplicationContext(), SHARE_TEXT);
    retry = 0;
    if (savedInstanceState != null) {
        capturedImageUri = savedInstanceState.getString(CAPTURED_IMAGE_URI) != null ? Uri.parse(savedInstanceState.getString(CAPTURED_IMAGE_URI)) : null;
        videoFileUri = savedInstanceState.getString(CAPTURED_VIDEO_URI) != null ? Uri.parse(savedInstanceState.getString(CAPTURED_VIDEO_URI)) : null;
        mediaFile = savedInstanceState.getSerializable(LOAD_FILE) != null ? (File) savedInstanceState.getSerializable(LOAD_FILE) : null;
        contact = (Contact) savedInstanceState.getSerializable(CONTACT);
        channel = (Channel) savedInstanceState.getSerializable(CHANNEL);
        currentConversationId = savedInstanceState.getInt(CONVERSATION_ID);
        if (contact != null || channel != null) {
            if (channel != null) {
                conversation = ConversationFragment.newInstance(null, channel, currentConversationId, null);
            } else {
                conversation = ConversationFragment.newInstance(contact, null, currentConversationId, null);
            }
            addFragment(this, conversation, ConversationUIService.CONVERSATION_FRAGMENT);
        }
    } else {
        setSearchListFragment(quickConversationFragment);
        addFragment(this, quickConversationFragment, ConversationUIService.QUICK_CONVERSATION_FRAGMENT);
    }
    mobiComKitBroadcastReceiver = new MobiComKitBroadcastReceiver(this);
    InstructionUtil.showInfo(this, R.string.info_message_sync, BroadcastService.INTENT_ACTIONS.INSTRUCTION.toString());
    mActionBar.setTitle(R.string.conversations);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    mActionBar.setHomeButtonEnabled(true);
    googleApiClient = new GoogleApiClient.Builder(getApplicationContext()).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
    onNewIntent(getIntent());
    Boolean takeOrder = getIntent().getBooleanExtra(TAKE_ORDER, false);
    if (!takeOrder) {
        Intent lastSeenStatusIntent = new Intent(this, UserIntentService.class);
        lastSeenStatusIntent.putExtra(UserIntentService.USER_LAST_SEEN_AT_STATUS, true);
        UserIntentService.enqueueWork(this, lastSeenStatusIntent);
    }
    if (ApplozicClient.getInstance(this).isAccountClosed() || ApplozicClient.getInstance(this).isNotAllowed()) {
        accountStatusAsyncTask = new SyncAccountStatusAsyncTask(this, layout, snackbar);
        accountStatusAsyncTask.execute();
    }
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    if (getIntent() != null) {
        Set<String> userIdLists = new HashSet<String>();
        if (getIntent().getStringArrayListExtra(ConversationUIService.GROUP_NAME_LIST_CONTACTS) != null) {
            MobiComUserPreference.getInstance(this).setIsContactGroupNameList(true);
            userIdLists.addAll(getIntent().getStringArrayListExtra(ConversationUIService.GROUP_NAME_LIST_CONTACTS));
        } else if (getIntent().getStringArrayListExtra(ConversationUIService.GROUP_ID_LIST_CONTACTS) != null) {
            MobiComUserPreference.getInstance(this).setIsContactGroupNameList(false);
            userIdLists.addAll(getIntent().getStringArrayListExtra(ConversationUIService.GROUP_ID_LIST_CONTACTS));
        }
        if (!userIdLists.isEmpty()) {
            MobiComUserPreference.getInstance(this).setContactGroupIdList(userIdLists);
        }
    }
    LocalBroadcastManager.getInstance(this).registerReceiver(mobiComKitBroadcastReceiver, BroadcastService.getIntentFilter());
}
Also used : GoogleApiClient(com.google.android.gms.common.api.GoogleApiClient) IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) AppContactService(com.applozic.mobicomkit.contact.AppContactService) ConversationUIService(com.applozic.mobicomkit.uiwidgets.conversation.ConversationUIService) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) MobiComKitBroadcastReceiver(com.applozic.mobicomkit.uiwidgets.conversation.MobiComKitBroadcastReceiver) Intent(android.content.Intent) ProfileFragment(com.applozic.mobicomkit.uiwidgets.people.fragment.ProfileFragment) MessageIntentService(com.applozic.mobicomkit.api.conversation.MessageIntentService) MobiComQuickConversationFragment(com.applozic.mobicomkit.uiwidgets.conversation.fragment.MobiComQuickConversationFragment) ColorDrawable(android.graphics.drawable.ColorDrawable) MobiComMessageService(com.applozic.mobicomkit.api.conversation.MobiComMessageService) File(java.io.File) Toolbar(android.support.v7.widget.Toolbar) HashSet(java.util.HashSet)

Example 5 with AlCustomizationSettings

use of com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings in project Applozic-Android-SDK by AppLozic.

the class MobiComAttachmentSelectorActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mobicom_multi_attachment_activity);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    fileClientService = new FileClientService(this);
    userPreferences = MobiComUserPreference.getInstance(this);
    Intent intent = getIntent();
    if (intent.getExtras() != null) {
        userID = intent.getExtras().getString(USER_ID);
        displayName = intent.getExtras().getString(DISPLAY_NAME);
        groupID = intent.getExtras().getInt(GROUP_ID, 0);
        groupName = intent.getExtras().getString(GROUP_NAME);
        imageUri = (Uri) intent.getParcelableExtra(URI_LIST);
        if (imageUri != null) {
            attachmentFileList.add(imageUri);
        }
    }
    initViews();
    setUpGridView();
    fileClientService = new FileClientService(this);
    if (imageUri == null) {
        Intent getContentIntent = FileUtils.createGetContentIntent();
        getContentIntent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
        Intent intentPick = Intent.createChooser(getContentIntent, getString(R.string.select_file));
        startActivityForResult(intentPick, REQUEST_CODE_ATTACH_PHOTO);
    }
    connectivityReceiver = new ConnectivityReceiver();
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) Intent(android.content.Intent)

Aggregations

AlCustomizationSettings (com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings)12 IntentFilter (android.content.IntentFilter)7 Toolbar (android.support.v7.widget.Toolbar)7 ConnectivityReceiver (com.applozic.mobicomkit.broadcast.ConnectivityReceiver)7 ColorDrawable (android.graphics.drawable.ColorDrawable)6 AppContactService (com.applozic.mobicomkit.contact.AppContactService)6 Intent (android.content.Intent)5 FileClientService (com.applozic.mobicomkit.api.attachment.FileClientService)4 ApplozicPermissions (com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions)4 Bitmap (android.graphics.Bitmap)3 View (android.view.View)3 ImageView (android.widget.ImageView)3 ConversationUIService (com.applozic.mobicomkit.uiwidgets.conversation.ConversationUIService)3 ImageLoader (com.applozic.mobicommons.commons.image.ImageLoader)3 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)3 MessageDatabaseService (com.applozic.mobicomkit.api.conversation.database.MessageDatabaseService)2 ContactDatabase (com.applozic.mobicomkit.contact.database.ContactDatabase)2 MobiComKitBroadcastReceiver (com.applozic.mobicomkit.uiwidgets.conversation.MobiComKitBroadcastReceiver)2 Contact (com.applozic.mobicommons.people.contact.Contact)2 GoogleApiClient (com.google.android.gms.common.api.GoogleApiClient)2