use of android.support.v4.view.GestureDetectorCompat 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);
}
use of android.support.v4.view.GestureDetectorCompat in project Signal-Android by signalapp.
the class MotionView method init.
private void init(@NonNull Context context, @Nullable AttributeSet attrs) {
// I fucking love Android
setWillNotDraw(false);
selectedLayerPaint = new Paint();
selectedLayerPaint.setAlpha((int) (255 * Constants.SELECTED_LAYER_ALPHA));
selectedLayerPaint.setAntiAlias(true);
this.editText = new EditText(context, attrs);
ViewCompat.setAlpha(this.editText, 0);
this.editText.setLayoutParams(new LayoutParams(1, 1, Gravity.TOP | Gravity.LEFT));
this.editText.setClickable(false);
this.editText.setBackgroundColor(Color.TRANSPARENT);
this.editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 1);
this.editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
this.addView(editText);
this.editText.clearFocus();
this.editText.addTextChangedListener(this);
// init listeners
this.scaleGestureDetector = new ScaleGestureDetector(context, new ScaleListener());
this.rotateGestureDetector = new RotateGestureDetector(context, new RotateListener());
this.moveGestureDetector = new MoveGestureDetector(context, new MoveListener());
this.gestureDetectorCompat = new GestureDetectorCompat(context, new TapsListener());
setOnTouchListener(onTouchListener);
updateUI();
}
use of android.support.v4.view.GestureDetectorCompat in project AndroidStudy by tinggengyan.
the class GestureDetectorMainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_button);
ButterKnife.bind(this);
mDetector = new GestureDetectorCompat(this, new MyGestureListener());
ViewConfiguration vc = ViewConfiguration.get(this.getApplicationContext());
// 最小的滑动距离
SWIPE_MIN_DISTANCE = vc.getScaledPagingTouchSlop();
// 最小的滑动速度
SWIPE_THRESHOLD_VELOCITY = vc.getScaledMinimumFlingVelocity();
// 最大的滑动距离,用来区分是不是滑动
SWIPE_MAX_OFF_PATH = vc.getScaledTouchSlop();
}
use of android.support.v4.view.GestureDetectorCompat in project Devsfolio by Madonahs.
the class ProfileFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
user = User.build(getArguments().getBundle(Constant.USER));
GestureDetector.SimpleOnGestureListener listener = new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
Intent intent = null;
switch(id) {
case R.id.phone_tv:
intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + mBinding.phoneTv.getText()));
break;
case R.id.email_tv:
intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:" + mBinding.emailTv.getText()));
break;
case R.id.web_tv:
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + mBinding.webTv.getText()));
break;
}
if (intent.resolveActivity(getActivity().getPackageManager()) != null)
startActivity(intent);
return true;
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
};
gd = new GestureDetectorCompat(getActivity(), listener);
}
use of android.support.v4.view.GestureDetectorCompat in project fqrouter by fqrouter.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
PreferenceManager.setDefaultValues(this, R.xml.preferences, true);
setTitle("fqrouter " + LaunchService.getMyVersion(this));
LaunchedIntent.register(this);
LaunchingIntent.register(this);
UpdateFoundIntent.register(this);
ExitedIntent.register(this);
DownloadingIntent.register(this);
DownloadedIntent.register(this);
DownloadFailedIntent.register(this);
HandleFatalErrorIntent.register(this);
DnsPollutedIntent.register(this);
HandleAlertIntent.register(this);
ExitingIntent.register(this);
SocksVpnConnectedIntent.register(this);
gestureDetector = new GestureDetectorCompat(this, new MyGestureDetector());
Button fullPowerButton = (Button) findViewById(R.id.fullPowerButton);
GoogleAnalytics gaInstance = GoogleAnalytics.getInstance(MainActivity.this);
gaTracker = gaInstance.getTracker("UA-37740383-2");
CookieSyncManager.createInstance(this);
fullPowerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
gaTracker.sendEvent("more-power", "click", "", new Long(0));
if (Build.VERSION.SDK_INT < 14) {
Uri uri = Uri.parse("http://127.0.0.1:" + ConfigUtils.getHttpManagerPort());
startActivity(new Intent(Intent.ACTION_VIEW, uri));
} else {
showWebView();
}
}
});
if (isReady) {
onReady();
showWebView();
} else {
LaunchService.execute(this);
}
}
Aggregations