Some fixes
This commit is contained in:
parent
d2e1d4d84c
commit
05de9efc55
|
@ -4,7 +4,7 @@ android {
|
|||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
versionCode 324
|
||||
versionName "2.21.1"
|
||||
|
@ -86,6 +86,7 @@ dependencies {
|
|||
implementation "com.google.guava:guava:$guavaLibraryVersion"
|
||||
implementation "com.github.chrisbanes:PhotoView:$photoViewLibraryVersion"
|
||||
implementation "com.github.stom79:SwipeBackLayout:$swipebackLibraryVersion"
|
||||
implementation 'com.r0adkll:slidableactivity:2.1.0'
|
||||
implementation 'com.github.stom79:country-picker-android:1.2.0'
|
||||
implementation 'com.github.stom79:mytransl:1.5'
|
||||
implementation 'com.github.stom79:SparkButton:1.0.12'
|
||||
|
|
|
@ -25,22 +25,20 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
@ -50,7 +48,10 @@ import androidx.viewpager.widget.PagerAdapter;
|
|||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
|
||||
import com.gw.swipeback.SwipeBackLayout;
|
||||
import com.r0adkll.slidr.Slidr;
|
||||
import com.r0adkll.slidr.model.SlidrConfig;
|
||||
import com.r0adkll.slidr.model.SlidrInterface;
|
||||
import com.r0adkll.slidr.model.SlidrPosition;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -59,7 +60,6 @@ import java.util.ArrayList;
|
|||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.client.Entities.Attachment;
|
||||
import app.fedilab.android.client.Entities.Error;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.client.HttpsConnection;
|
||||
import app.fedilab.android.fragments.MediaSliderFragment;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
|
@ -77,8 +77,10 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
private int mediaPosition;
|
||||
private ViewPager mPager;
|
||||
private long downloadID;
|
||||
public SwipeBackLayout mSwipeBackLayout;
|
||||
private boolean fullscreen;
|
||||
public SlidrInterface slidrInterface;
|
||||
int flags;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
|
@ -98,9 +100,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
setTheme(R.style.TransparentDark);
|
||||
}
|
||||
setContentView(R.layout.activity_media_pager);
|
||||
supportPostponeEnterTransition();
|
||||
supportStartPostponedEnterTransition();
|
||||
SwipeBackLayout swipeBackLayout = findViewById(R.id.swipeBackLayout);
|
||||
CoordinatorLayout swipeBackLayout = findViewById(R.id.swipeBackLayout);
|
||||
if (theme == Helper.THEME_LIGHT) {
|
||||
swipeBackLayout.setBackgroundResource(R.color.white);
|
||||
} else if (theme == Helper.THEME_BLACK) {
|
||||
|
@ -110,6 +110,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
}
|
||||
fullscreen = false;
|
||||
|
||||
flags = getWindow().getDecorView().getSystemUiVisibility();
|
||||
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
@ -197,39 +198,22 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
registerReceiver(onDownloadComplete,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
|
||||
|
||||
|
||||
SlidrConfig config = new SlidrConfig.Builder()
|
||||
.sensitivity(1f)
|
||||
.scrimColor(Color.BLACK)
|
||||
.scrimStartAlpha(0.8f)
|
||||
.scrimEndAlpha(0f)
|
||||
.position(SlidrPosition.VERTICAL)
|
||||
.velocityThreshold(2400)
|
||||
.distanceThreshold(0.25f)
|
||||
.edgeSize(0.18f)
|
||||
.build();
|
||||
|
||||
mSwipeBackLayout = new SwipeBackLayout(SlideMediaActivity.this);
|
||||
mSwipeBackLayout.setDirectionMode(SwipeBackLayout.FROM_TOP);
|
||||
mSwipeBackLayout.setMaskAlpha(125);
|
||||
mSwipeBackLayout.setSwipeBackFactor(0.5f);
|
||||
mSwipeBackLayout.setSwipeBackListener(new SwipeBackLayout.OnSwipeBackListener() {
|
||||
@Override
|
||||
public void onViewPositionChanged(View mView, float swipeBackFraction, float SWIPE_BACK_FACTOR) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewSwipeFinished(View mView, boolean isEnd) {
|
||||
if (isEnd){
|
||||
finish();
|
||||
overridePendingTransition(0, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mSwipeBackLayout.attachToActivity(this);
|
||||
slidrInterface = Slidr.attach(this, config);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP ) {
|
||||
if (mCurrentFragment.canSwipe()) {
|
||||
fullscreen = !fullscreen;
|
||||
setFullscreen(fullscreen);
|
||||
}
|
||||
}
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
private BroadcastReceiver onDownloadComplete = new BroadcastReceiver() {
|
||||
@Override
|
||||
|
@ -246,12 +230,14 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
shareIntent.setType(cR.getType(uri));
|
||||
try {
|
||||
startActivity(shareIntent);
|
||||
}catch (Exception e){}
|
||||
}catch (Exception ignored){}
|
||||
manager.remove(downloadID);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -323,10 +309,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
|||
this.fullscreen = fullscreen;
|
||||
View mDecorView = getWindow().getDecorView();
|
||||
if (!fullscreen) {
|
||||
mDecorView.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
mDecorView.setSystemUiVisibility(flags);
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
mDecorView.setSystemUiVisibility(
|
||||
|
|
|
@ -15,7 +15,6 @@ package app.fedilab.android.drawers;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -23,8 +22,6 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -54,7 +51,6 @@ import app.fedilab.android.sqlite.Sqlite;
|
|||
import app.fedilab.android.sqlite.StatusCacheDAO;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.MediaActivity;
|
||||
import app.fedilab.android.activities.ShowAccountActivity;
|
||||
import app.fedilab.android.activities.ShowConversationActivity;
|
||||
import app.fedilab.android.interfaces.OnPostActionInterface;
|
||||
|
@ -217,9 +213,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
|
|||
intent.putParcelableArrayListExtra("mediaArray", attachments);
|
||||
b.putInt("position", 0);
|
||||
intent.putExtras(b);
|
||||
ViewCompat.setTransitionName(v, status.getMedia_attachments().get(0).getUrl());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, v, status.getMedia_attachments().get(0).getUrl());
|
||||
context.startActivity(intent, options.toBundle());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.art_author.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -14,14 +14,11 @@ package app.fedilab.android.drawers;
|
|||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -38,7 +35,6 @@ import app.fedilab.android.activities.SlideMediaActivity;
|
|||
import app.fedilab.android.client.Entities.Attachment;
|
||||
import app.fedilab.android.client.Entities.Status;
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.activities.MediaActivity;
|
||||
import app.fedilab.android.activities.ShowAccountActivity;
|
||||
import app.fedilab.android.activities.ShowConversationActivity;
|
||||
|
||||
|
@ -92,9 +88,7 @@ public class ImageAdapter extends RecyclerView.Adapter {
|
|||
intent.putParcelableArrayListExtra("mediaArray", attachmentsTmp);
|
||||
b.putInt("position", (viewHolder.getAdapterPosition() + 1));
|
||||
intent.putExtras(b);
|
||||
ViewCompat.setTransitionName(v, status.getMedia_attachments().get(0).getUrl());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, v, status.getMedia_attachments().get(0).getUrl());
|
||||
context.startActivity(intent, options.toBundle());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
holder.imageView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
|
|
|
@ -1388,9 +1388,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
intent.putParcelableArrayListExtra("mediaArray", notification.getStatus().getMedia_attachments());
|
||||
b.putInt("position", finalPosition);
|
||||
intent.putExtras(b);
|
||||
ViewCompat.setTransitionName(v, notification.getStatus().getMedia_attachments().get(0).getUrl());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, v, notification.getStatus().getMedia_attachments().get(0).getUrl());
|
||||
context.startActivity(intent, options.toBundle());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
i++;
|
||||
|
|
|
@ -489,9 +489,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
|||
intent.putParcelableArrayListExtra("mediaArray", status.getMedia_attachments());
|
||||
b.putInt("position", 0);
|
||||
intent.putExtras(b);
|
||||
ViewCompat.setTransitionName(v, status.getMedia_attachments().get(0).getUrl());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, v, status.getMedia_attachments().get(0).getUrl());
|
||||
context.startActivity(intent, options.toBundle());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -113,8 +113,7 @@ public class SliderAdapter extends SliderViewAdapter<SliderAdapter.SliderAdapter
|
|||
intent.putParcelableArrayListExtra("mediaArray", attachments);
|
||||
b.putInt("position", (position + 1));
|
||||
intent.putExtras(b);
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) contextWeakReference.get(), v, attachments.get(0).getUrl());
|
||||
contextWeakReference.get().startActivity(intent, options.toBundle());
|
||||
contextWeakReference.get().startActivity(intent);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
|
|
@ -3794,9 +3794,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
intent.putParcelableArrayListExtra("mediaArray", attachmentArrayList);
|
||||
b.putInt("position", finalPosition);
|
||||
intent.putExtras(b);
|
||||
ViewCompat.setTransitionName(v, attachment.getUrl());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, v, attachment.getUrl());
|
||||
ActivityCompat.startActivity(context, intent, options.toBundle());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} else {
|
||||
status.setAttachmentShown(true);
|
||||
|
|
|
@ -160,14 +160,16 @@ public class MediaSliderFragment extends Fragment implements MediaPlayer.OnCompl
|
|||
@Override
|
||||
public void onMatrixChanged(RectF rect) {
|
||||
canSwipe = (imageView.getScale() == 1);
|
||||
((SlideMediaActivity)context).mSwipeBackLayout.isDisabled(imageView.getScale() != 1);
|
||||
|
||||
if( !canSwipe){
|
||||
if( ! ((SlideMediaActivity)context).getFullScreen()) {
|
||||
((SlideMediaActivity) context).setFullscreen(true);
|
||||
((SlideMediaActivity) context).slidrInterface.lock();
|
||||
}
|
||||
}else{
|
||||
if( ((SlideMediaActivity)context).getFullScreen()) {
|
||||
((SlideMediaActivity) context).setFullscreen(false);
|
||||
((SlideMediaActivity) context).slidrInterface.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,20 +14,16 @@
|
|||
You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<com.gw.swipeback.SwipeBackLayout
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:animateLayoutChanges="true"
|
||||
android:id="@+id/swipeBackLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:directionMode="bottom"
|
||||
app:isSwipeFromEdge="true"
|
||||
app:maskAlpha="125"
|
||||
app:swipeBackFactor="0.5">
|
||||
|
||||
>
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/media_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
</com.gw.swipeback.SwipeBackLayout>
|
||||
/>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -1,4 +1,4 @@
|
|||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<attr format="reference" name="headerbg" />
|
||||
<attr format="reference" name="shapeBorder" />
|
||||
<attr format="reference" name="imgbd" />
|
||||
|
|
Loading…
Reference in New Issue