Search in sources :

Example 6 with GestureDetectorCompat

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);
}
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 7 with GestureDetectorCompat

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();
}
Also used : EditText(android.widget.EditText) MoveGestureDetector(org.thoughtcrime.securesms.scribbles.multitouch.MoveGestureDetector) Paint(android.graphics.Paint) ScaleGestureDetector(android.view.ScaleGestureDetector) RotateGestureDetector(org.thoughtcrime.securesms.scribbles.multitouch.RotateGestureDetector) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat)

Example 8 with GestureDetectorCompat

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();
}
Also used : ViewConfiguration(android.view.ViewConfiguration) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat)

Example 9 with GestureDetectorCompat

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);
}
Also used : GestureDetector(android.view.GestureDetector) Intent(android.content.Intent) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) MotionEvent(android.view.MotionEvent)

Example 10 with GestureDetectorCompat

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);
    }
}
Also used : GoogleAnalytics(com.google.analytics.tracking.android.GoogleAnalytics) Button(android.widget.Button) Intent(android.content.Intent) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat) WebView(android.webkit.WebView) TextView(android.widget.TextView) Uri(android.net.Uri)

Aggregations

GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)33 MotionEvent (android.view.MotionEvent)12 ScaleGestureDetector (android.view.ScaleGestureDetector)8 Paint (android.graphics.Paint)6 Intent (android.content.Intent)5 View (android.view.View)5 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 RecyclerView (android.support.v7.widget.RecyclerView)4 GestureDetector (android.view.GestureDetector)4 LayoutInflater (android.view.LayoutInflater)4 OverScroller (android.widget.OverScroller)4 Context (android.content.Context)3 Bundle (android.os.Bundle)3 TextPaint (android.text.TextPaint)3 ViewGroup (android.view.ViewGroup)3 ImageView (android.widget.ImageView)3 Link (com.winsonchiu.reader.data.reddit.Link)3 Sort (com.winsonchiu.reader.data.reddit.Sort)3 AdapterLink (com.winsonchiu.reader.links.AdapterLink)3 Activity (android.app.Activity)2