Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@
android:versionCode="160"
android:versionName="2.20.1">

<queries>
<package android:name="com.google.android.apps.maps" />
<intent>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="geo"/>
</intent>
</queries>

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Binary file added app/src/main/assets/found.mp3
Binary file not shown.
Binary file modified app/src/main/assets/lost.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/java/s4y/itag/BootReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void onReceive(@NonNull Context context, @NonNull Intent intent) {
"android.intent.action.QUICKBOOT_POWERON".equals(intent.getAction())
) {
ITagsStoreInterface store = new ITagsStoreDefault(ITagApplication.context);
if (store.isDisconnectAlert()) {
if (store.isDisconnectAlertOn()) {
ITagsService.start(context);
// expected to create application and thus init waytooday
// and enter foreground
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/s4y/itag/ITagApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static public void faWtNoTrackID() {
@Override
public void onTerminate() {
try {
ITag.close();
ITag.closeApplication();
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
74 changes: 74 additions & 0 deletions app/src/main/java/s4y/itag/ITagImageView.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package s4y.itag;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;

public class ITagImageView extends AppCompatImageView {

private static final String LT = ITagImageView.class.getName();

public ITagImageView(Context context) {
super(context);
}
Expand All @@ -20,4 +29,69 @@ public ITagImageView(Context context, @Nullable AttributeSet attrs, int defStyle
super(context, attrs, defStyleAttr);
}

private static final int CLICK_INTERVAL = ViewConfiguration.getLongPressTimeout();

private final android.os.Handler clickHandler = new Handler(Looper.getMainLooper());
private final Runnable waitNext = () -> {
isLongPress = true;
Log.d(LT, "waitNext called");
};

boolean isLongPress = false;

@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
clickHandler.postDelayed(waitNext, CLICK_INTERVAL);
Log.d(LT, "action down");
startScaleAnimation(this);
return true;
case MotionEvent.ACTION_UP:
clickHandler.removeCallbacks(waitNext);
cancelScaleAnimation(this);
Log.d(LT, "callbacks removed");
if(isLongPress){
//performLongClick();
Log.d(LT, "is longpress");
isLongPress = false;
} else {
Log.d(LT, "call performClick");
}
return true;
}
return false;
}

// Because we call this from onTouchEvent, this code will be executed for both
// normal touch events and for when the system calls this using Accessibility
@Override
public boolean performClick() {
super.performClick();
Log.d(LT, "super.performClick()");
return true;
}

private void startScaleAnimation(View view) {
ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(view, "scaleX", 0.8f);
ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(view, "scaleY", 0.8f);
scaleDownX.setDuration(150);
scaleDownY.setDuration(150);

scaleDownX.start();
scaleDownY.start();
}

private void cancelScaleAnimation(View view) {
ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(view, "scaleX", 1.0f);
ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(view, "scaleY", 1.0f);
scaleDownX.setDuration(150);
scaleDownY.setDuration(150);

scaleDownX.start();
scaleDownY.start();
}

}
Loading