Search in sources :

Example 1 with ApplozicPermissions

use of com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions 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 2 with ApplozicPermissions

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

the class MobicomLocationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_applozic_location);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_map_screen);
    toolbar.setTitle(getResources().getString(R.string.send_location));
    setSupportActionBar(toolbar);
    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())) {
        getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(alCustomizationSettings.getThemeColorPrimary())));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor(alCustomizationSettings.getThemeColorPrimaryDark()));
        }
    }
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    layout = (LinearLayout) findViewById(R.id.footerAd);
    sendLocation = (RelativeLayout) findViewById(R.id.sendLocation);
    mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    applozicPermissions = new ApplozicPermissions(MobicomLocationActivity.this, layout);
    googleApiClient = new GoogleApiClient.Builder(getApplicationContext()).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).build();
    processLocation();
    onNewIntent(getIntent());
    connectivityReceiver = new ConnectivityReceiver();
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : GoogleApiClient(com.google.android.gms.common.api.GoogleApiClient) IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ColorDrawable(android.graphics.drawable.ColorDrawable) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with ApplozicPermissions

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

the class ChannelCreateActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.channel_create_activty_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    if (!TextUtils.isEmpty(jsonString)) {
        alCustomizationSettings = (AlCustomizationSettings) GsonUtils.getObjectFromJson(jsonString, AlCustomizationSettings.class);
    } else {
        alCustomizationSettings = new AlCustomizationSettings();
    }
    connectivityReceiver = new ConnectivityReceiver();
    userPreference = MobiComUserPreference.getInstance(ChannelCreateActivity.this);
    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()));
        }
    }
    mActionBar.setTitle(R.string.channel_create_title);
    mActionBar.setDisplayShowHomeEnabled(true);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    finishActivityReceiver = new FinishActivityReceiver();
    registerReceiver(finishActivityReceiver, new IntentFilter(ACTION_FINISH_CHANNEL_CREATE));
    layout = (LinearLayout) findViewById(R.id.footerAd);
    applozicPermissions = new ApplozicPermissions(this, layout);
    channelName = (EditText) findViewById(R.id.channelName);
    circleImageView = (CircleImageView) findViewById(R.id.channelIcon);
    uploadImageButton = (CircleImageView) findViewById(R.id.applozic_channel_profile_camera);
    uploadImageButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processImagePicker();
        }
    });
    int drawableResourceId = getResources().getIdentifier(alCustomizationSettings.getAttachCameraIconName(), "drawable", getPackageName());
    uploadImageButton.setImageResource(drawableResourceId);
    fileClientService = new FileClientService(this);
    if (getIntent() != null) {
        groupType = getIntent().getIntExtra(GROUP_TYPE, Channel.GroupType.PUBLIC.getValue().intValue());
    }
    /* groupType = getIntent().getIntExtra(GROUP_TYPE, Channel.GroupType.PRIVATE.getValue().intValue());
        if(groupType.equals(Channel.GroupType.BROADCAST.getValue().intValue())){
            circleImageView.setImageResource(R.drawable.applozic_ic_applozic_broadcast);
            uploadImageButton.setVisibility(View.GONE);
        }*/
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) Toolbar(android.support.v7.widget.Toolbar)

Example 4 with ApplozicPermissions

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

the class ChannelNameActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.update_channel_name_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    layout = (LinearLayout) findViewById(R.id.footerAd);
    applozicPermissions = new ApplozicPermissions(this, layout);
    mActionBar.setTitle(getString(R.string.update_channel_title_name));
    selectImageProfileIcon = (CircleImageView) findViewById(R.id.applozic_group_profile_camera);
    applozicGroupProfileIcon = (ImageView) findViewById(R.id.applozic_group_profile);
    String jsonString = FileUtils.loadSettingsJsonFile(getApplicationContext());
    fileClientService = new FileClientService(this);
    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()));
        }
    }
    int drawableResourceId = getResources().getIdentifier(alCustomizationSettings.getAttachCameraIconName(), "drawable", getPackageName());
    selectImageProfileIcon.setImageResource(drawableResourceId);
    if (getIntent().getExtras() != null) {
        String groupInfoJson = getIntent().getExtras().getString(ChannelInfoActivity.GROUP_UPDTAE_INFO);
        groupInfoUpdate = (GroupInfoUpdate) GsonUtils.getObjectFromJson(groupInfoJson, GroupInfoUpdate.class);
    }
    if (groupInfoUpdate != null && !TextUtils.isEmpty(groupInfoUpdate.getLocalImagePath())) {
        File file = new File(groupInfoUpdate.getLocalImagePath());
        Uri uri = Uri.parse(file.getAbsolutePath());
        if (uri != null) {
            Utils.printLog(this, "ChannelNameActivity::", uri.toString());
            applozicGroupProfileIcon.setImageURI(uri);
        }
    } else {
        applozicGroupProfileIcon.setImageResource(R.drawable.applozic_group_icon);
    }
    channelName = (EditText) findViewById(R.id.newChannelName);
    channelName.setText(groupInfoUpdate.getNewName());
    ok = (Button) findViewById(R.id.channelNameOk);
    cancel = (Button) findViewById(R.id.channelNameCancel);
    selectImageProfileIcon.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            processImagePicker();
        }
    });
    ok.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (channelName.getText().toString().equals(groupInfoUpdate.getNewName()) && imageChangeUri == null || groupInfoUpdate.getNewName() == null) {
                ChannelNameActivity.this.finish();
            }
            if (TextUtils.isEmpty(channelName.getText().toString()) || channelName.getText().toString().trim().length() == 0) {
                Toast.makeText(ChannelNameActivity.this, getString(R.string.channel_name_empty), Toast.LENGTH_SHORT).show();
                ChannelNameActivity.this.finish();
            } else {
                Intent intent = new Intent();
                groupInfoUpdate.setNewName(channelName.getText().toString());
                if (imageChangeUri != null && profilePhotoFile != null) {
                    groupInfoUpdate.setNewlocalPath(profilePhotoFile.getAbsolutePath());
                    groupInfoUpdate.setContentUri(imageChangeUri.toString());
                }
                intent.putExtra(ChannelInfoActivity.GROUP_UPDTAE_INFO, GsonUtils.getJsonFromObject(groupInfoUpdate, GroupInfoUpdate.class));
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    });
    cancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ChannelNameActivity.this.finish();
        }
    });
    connectivityReceiver = new ConnectivityReceiver();
    registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
Also used : IntentFilter(android.content.IntentFilter) AlCustomizationSettings(com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings) ApplozicPermissions(com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions) ConnectivityReceiver(com.applozic.mobicomkit.broadcast.ConnectivityReceiver) FileClientService(com.applozic.mobicomkit.api.attachment.FileClientService) Intent(android.content.Intent) Uri(android.net.Uri) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) CropImageView(com.theartofdev.edmodo.cropper.CropImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) File(java.io.File) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

IntentFilter (android.content.IntentFilter)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 Toolbar (android.support.v7.widget.Toolbar)4 ConnectivityReceiver (com.applozic.mobicomkit.broadcast.ConnectivityReceiver)4 AlCustomizationSettings (com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings)4 ApplozicPermissions (com.applozic.mobicomkit.uiwidgets.instruction.ApplozicPermissions)4 Intent (android.content.Intent)2 View (android.view.View)2 ImageView (android.widget.ImageView)2 FileClientService (com.applozic.mobicomkit.api.attachment.FileClientService)2 GoogleApiClient (com.google.android.gms.common.api.GoogleApiClient)2 CropImageView (com.theartofdev.edmodo.cropper.CropImageView)2 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)2 File (java.io.File)2 Uri (android.net.Uri)1 MessageIntentService (com.applozic.mobicomkit.api.conversation.MessageIntentService)1 MobiComMessageService (com.applozic.mobicomkit.api.conversation.MobiComMessageService)1 AppContactService (com.applozic.mobicomkit.contact.AppContactService)1 ConversationUIService (com.applozic.mobicomkit.uiwidgets.conversation.ConversationUIService)1 MobiComKitBroadcastReceiver (com.applozic.mobicomkit.uiwidgets.conversation.MobiComKitBroadcastReceiver)1