use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.
the class AccountFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle arguments = getArguments();
if (arguments != null) {
mMobileEditText = (EditText) view.findViewById(R.id.mobileNumberTextDialog);
mMobileEditText.setText(arguments.getString(ARG_MOBILE));
mMobileEditText.addTextChangedListener(this);
mMobileEditText.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
final int DRAWABLE_RIGHT = 2;
if (event.getAction() == MotionEvent.ACTION_UP) {
if (event.getRawX() >= (mMobileEditText.getRight() - mMobileEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
mListener.onAlertDialog(getString(R.string.phonenumber_info_text_title), getString(R.string.phonenumber_info_text));
return true;
}
}
return false;
}
});
mOutgoingEditText = (EditText) view.findViewById(R.id.outgoingNumberTextDialog);
String outGoingNumber = arguments.getString(ARG_OUTGOING);
// TODO Find a better solution for this (VIALA-575) in future.
if (outGoingNumber == null || outGoingNumber.isEmpty()) {
// Forced logging due to user not being able to set/unset it at this point.
mRemoteLogger = new RemoteLogger(AccountFragment.class).forceRemoteLogging(true);
mRemoteLogger.d("no outGoingNumber");
SystemUser systemUser = (SystemUser) new JsonStorage(getActivity()).get(SystemUser.class);
outGoingNumber = systemUser.getOutgoingCli();
}
// Sometimes the outgoing number is suppressed (anonymous), so we capture that here.
if (outGoingNumber != null && outGoingNumber.equals(SUPPRESSED)) {
outGoingNumber = getString(R.string.supressed_number);
}
mOutgoingEditText.setText(outGoingNumber);
mOutgoingEditText.addTextChangedListener(this);
mConfigureButton = (Button) view.findViewById(R.id.button_configure);
mConfigureButton.setOnClickListener(this);
// enable configure button when mobile number is available for the SystemUser
if (mMobileEditText.getText().length() > 0) {
mConfigureButton.setEnabled(true);
}
}
}
use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.
the class SetupActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setup);
mJsonStorage = new JsonStorage(this);
mPreferences = new Preferences(this);
// Forced logging due to user not being able to set/unset it at this point.
mRemoteLogger = new RemoteLogger(SetupActivity.class).forceRemoteLogging(true);
Fragment gotoFragment = null;
Integer fragmentId = null;
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
fragmentId = bundle.getInt("fragment");
mActivityToReturnToName = bundle.getString("activity");
if (fragmentId == R.id.fragment_voip_account_missing) {
gotoFragment = ((SetUpVoipAccountFragment) getFragmentManager().findFragmentById(fragmentId)).newInstance();
} else if (fragmentId == R.id.fragment_account) {
SystemUser systemUser = (SystemUser) mJsonStorage.get(SystemUser.class);
gotoFragment = ((AccountFragment) getFragmentManager().findFragmentById(fragmentId)).newInstance(systemUser.getMobileNumber(), systemUser.getOutgoingCli());
}
}
if (findViewById(R.id.fragment_container) != null) {
if (gotoFragment == null) {
gotoFragment = LogoFragment.newInstance();
}
if (fragmentId != null && fragmentId == R.id.fragment_account) {
swapFragment(gotoFragment, AccountFragment.class.getSimpleName());
} else {
swapFragment(gotoFragment, gotoFragment.getClass().getSimpleName());
}
}
}
use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.
the class ContactCursorLoader method populateMatrixCursor.
/**
* Populate a MatrixCursor that is UI friendly with the matches found for the t9 query.
* @param matches List of T9Match objects to be inserted into the MatrixCursor.
*/
void populateMatrixCursor(List<T9Match> matches) {
// Create a mutable cursor to manipulate for search.
if (mMatrixCursor == null) {
mMatrixCursor = new MatrixCursor(new String[] { "_id", "name", "photo", "number", "type" });
}
T9Match match;
boolean addResult;
String displayName;
String number;
int type;
String label;
for (int i = 0; i < matches.size(); i++) {
match = matches.get(i);
displayName = match.getDisplayName();
number = match.getNumber();
type = match.getType();
if (type == ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM) {
label = match.getLabel();
} else {
label = ContactsContract.CommonDataKinds.Phone.getTypeLabel(mContext.getResources(), type, "").toString();
}
addResult = false;
if (mT9Query.length() != 0) {
// Only allowed T9 chars for name matching.
if (mT9Query.substring(0, 1).matches("[2-9]")) {
if (T9NameMatcher.T9QueryMatchesName(mT9Query, displayName)) {
addResult = true;
try {
displayName = T9NameMatcher.highlightMatchedPart(mT9Query, displayName);
} catch (Exception e) {
// TODO: Remove this piece of code if we find the bug. Until then
// force remote logging.
RemoteLogger logger = new RemoteLogger(ContactCursorLoader.class).forceRemoteLogging(true);
logger.e(e.getClass().getSimpleName());
logger.e("QUERY: " + mT9Query);
logger.e("DISPLAYNAME: " + displayName);
// Log displayname B64 encoded in case of formatting done by our logging.
logger.e("ENCODED DISPLAYNAME: " + Base64.encodeToString(displayName.getBytes(), 0));
// Displayname will be shown without highlighting.
}
}
}
if (number != null) {
if (number.startsWith("+")) {
if (("0" + number.substring(3)).startsWith(mT9Query)) {
addResult = true;
number = "<b>" + number.substring(0, mT9Query.length() + 2) + "</b>" + number.substring(mT9Query.length() + 2);
}
}
if (number.startsWith(mT9Query)) {
addResult = true;
number = "<b>" + number.substring(0, mT9Query.length()) + "</b>" + number.substring(mT9Query.length());
}
}
} else {
// No query so add all 20 results.
addResult = true;
}
if (addResult) {
mMatrixCursor.addRow(new Object[] { Long.toString(match.getContactId()), displayName, match.getThumbnailUri(), number, label });
}
}
}
use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.
the class TwoStepCallActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two_step_call);
/* set the AnalyticsHelper */
mAnalyticsHelper = new AnalyticsHelper(((AnalyticsApplication) getApplication()).getDefaultTracker());
mSystemUser = (SystemUser) new JsonStorage(this).get(SystemUser.class);
mApi = ServiceGenerator.createService(this, Api.class, getString(R.string.api_url), getEmail(), getPassword());
mRemoteLogger = new RemoteLogger(TwoStepCallActivity.class);
String numberToCall = getIntent().getStringExtra(NUMBER_TO_CALL);
mTwoStepCallTask = new TwoStepCallTask(mApi, mSystemUser.getMobileNumber(), numberToCall);
mTwoStepCallTask.execute();
mStatusTextView = ((TextView) findViewById(R.id.status_text_view));
mTwoStepCallView = (TwoStepCallView) findViewById(R.id.two_step_call_view);
mTwoStepCallView.setOutgoingNumber(mSystemUser.getOutgoingCli());
mTwoStepCallView.setNumberA(mSystemUser.getMobileNumber());
mTwoStepCallView.setNumberB(numberToCall);
updateStateView(TwoStepCallUtils.STATE_INITIAL);
mAnalyticsHelper.sendEvent(getString(R.string.analytics_event_category_call), getString(R.string.analytics_event_action_outbound), getString(R.string.analytics_event_label_connect_a_b));
((TextView) findViewById(R.id.name_text_view)).setText(numberToCall);
}
use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.
the class BluetoothMediaSessionService method onCreate.
@Override
public void onCreate() {
mContext = this;
mRemoteLogger = new RemoteLogger(BluetoothMediaSessionService.class).enableConsoleLogging();
mRemoteLogger.v("onCreate()");
MediaSessionCompat session = new MediaSessionCompat(this, TAG);
PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder();
stateBuilder.setActions(PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PLAY_PAUSE | PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID | PlaybackStateCompat.ACTION_PAUSE | PlaybackStateCompat.ACTION_SKIP_TO_NEXT | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS);
stateBuilder.setState(PlaybackStateCompat.STATE_PLAYING, 0, 1);
session.setPlaybackState(stateBuilder.build());
session.setCallback(mSessionCallback);
session.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS | MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS);
session.setPlaybackToLocal(AudioManager.STREAM_VOICE_CALL);
mSession = session;
}
Aggregations