Skip to content

Commit

Permalink
Merge branch 'dev' into central-master
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbWatershed committed Jan 24, 2021
2 parents 17db585 + b70705d commit 42ef82d
Show file tree
Hide file tree
Showing 17 changed files with 595 additions and 365 deletions.
1 change: 1 addition & 0 deletions .proguard/proguard-7zip.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class net.sf.sevenzipjbinding.** { *; }
19 changes: 16 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ if (file('signing.gradle').exists()) {
apply from: 'signing.gradle'
}

repositories {
exclusiveContent {
forRepository {
maven {
url 'https://dl.bintray.com/omicronapps/7-Zip-JBinding-4Android'
}
}
filter {
includeGroup "net.sf.sevenzipjbinding"
}
}
}

android {
compileSdkVersion 30
compileOptions {
Expand All @@ -25,7 +38,7 @@ android {
//noinspection ExpiringTargetSdkVersion
targetSdkVersion 30
versionCode 130 // is updated automatically by BitRise; only used when building locally
versionName '1.13.8'
versionName '1.13.9'

def fkToken = '\"' + (System.getenv("FK_TOKEN") ?: "") + '\"'
def includeObjectBoxBrowser = System.getenv("INCLUDE_OBJECTBOX_BROWSER") ?: "false"
Expand Down Expand Up @@ -243,8 +256,8 @@ dependencies {
// Cleaner date manipulation
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'

// RAR archive management
implementation "com.github.junrar:junrar:7.4.0"
// Archive management
implementation 'net.sf.sevenzipjbinding:sevenzipjbinding:16.02-2.01'

/**
* ANALYTICS
Expand Down
3 changes: 2 additions & 1 deletion app/proguard-rules-debug.pro
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
}
-keep class net.sf.sevenzipjbinding.** { *; }
2 changes: 2 additions & 0 deletions app/src/main/java/me/devsaki/hentoid/HentoidApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public void onCreate() {
super.onCreate();
instance = this;

Timber.i("Initializing %s", R.string.app_name);

// Fix the SSLHandshake error with okhttp on Android 4.1-4.4 when server only supports TLS1.2
// see https://github.com/square/okhttp/issues/2372 for more information
// NB : Takes ~250ms at startup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
public class ImageViewerActivity extends BaseActivity {

private VolumeKeyListener volumeKeyListener = null;
private ImageViewerViewModel viewModel = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -42,7 +43,7 @@ protected void onCreate(Bundle savedInstanceState) {


ViewModelFactory vmFactory = new ViewModelFactory(getApplication());
ImageViewerViewModel viewModel = new ViewModelProvider(this, vmFactory).get(ImageViewerViewModel.class);
viewModel = new ViewModelProvider(this, vmFactory).get(ImageViewerViewModel.class);

if (null == viewModel.getContent().getValue()) { // ViewModel hasn't loaded anything yet (fresh start)
Bundle searchParams = parser.getSearchParams();
Expand Down Expand Up @@ -93,6 +94,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
@Override
protected void onStop() {
unregisterKeyListener();
if (viewModel != null) viewModel.emptyCacheFolder();
super.onStop();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class FakkuActivity extends BaseWebActivity {

private static final String DOMAIN_FILTER = "fakku.net";
private static final String[] GALLERY_FILTER = {"fakku.net/hentai/[A-Za-z0-9\\-]+$"};
private static final String[] GALLERY_FILTER = {"fakku.net/hentai/[A-Za-z0-9\\-_]+$"};

Site getStartSite() {
return Site.FAKKU2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ public void insertImageFile(@NonNull ImageFile img) {
}

public void replaceImageList(long contentId, @NonNull final List<ImageFile> newList) {
db.deleteImageFiles(contentId);
for (ImageFile img : newList) img.setContentId(contentId);
db.insertImageFiles(newList);
db.replaceImageFiles(contentId, newList);
}

public void updateImageContentStatus(long contentId, StatusContent updateFrom, @NonNull StatusContent updateTo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,14 @@ void insertImageFiles(@NonNull List<ImageFile> imgs) {
store.boxFor(ImageFile.class).put(imgs);
}

void replaceImageFiles(long contentId, @NonNull final List<ImageFile> newList) {
store.runInTx(() -> {
deleteImageFiles(contentId);
for (ImageFile img : newList) img.setContentId(contentId);
insertImageFiles(newList);
});
}

@Nullable
ImageFile selectImageFile(long id) {
if (id > 0) return store.boxFor(ImageFile.class).get(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public void computeDownloadedBytes() {

public long getNbDownloadedPages() {
if (imageFiles != null)
return Stream.of(imageFiles).filter(i -> (i.getStatus() == StatusContent.DOWNLOADED || i.getStatus() == StatusContent.EXTERNAL) && !i.isCover()).count();
return Stream.of(imageFiles).filter(i -> (i.getStatus() == StatusContent.DOWNLOADED || i.getStatus() == StatusContent.EXTERNAL) && i.isReadable()).count();
else return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,21 @@ public void onDestroy() {
public void onProcessEvent(ProcessEvent event) {
if (null == binding) return;
if (ProcessEvent.EventType.PROGRESS == event.eventType) {
adapter.submitList(Collections.emptyList()); // Empty display until loading is complete
// Empty display until loading is complete
if (adapter.getItemCount() > 0) adapter.submitList(Collections.emptyList());

// Prevent switching books when archive extraction is in progress (may trigger multiple extractions at the same time)
// TODO make that possible in the future when unarchival is done on demand
binding.controlsOverlay.viewerPrevBookBtn.setVisibility(View.INVISIBLE);
binding.controlsOverlay.viewerNextBookBtn.setVisibility(View.INVISIBLE);

binding.viewerLoadingTxt.setText(getResources().getString(R.string.loading_images, event.elementsKO + event.elementsOK, event.elementsTotal));
binding.viewerLoadingTxt.setVisibility(View.VISIBLE);
} else if (ProcessEvent.EventType.COMPLETE == event.eventType)
} else if (ProcessEvent.EventType.COMPLETE == event.eventType) {
binding.viewerLoadingTxt.setVisibility(View.GONE);
binding.controlsOverlay.viewerPrevBookBtn.setVisibility(View.VISIBLE);
binding.controlsOverlay.viewerNextBookBtn.setVisibility(View.VISIBLE);
}
}

private void initPager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ private void migrateLibrary(@NonNull final List<LogUtil.LogEntry> log, @NonNull
if (content.getJsonUri().isEmpty() || !content.getJsonUri().startsWith("content"))
content.setJsonUri("");

//dao.insertContent(content);
ContentHelper.addContent(this, dao, content);

List<ImageFile> contentImages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import me.devsaki.hentoid.enums.Grouping;
import me.devsaki.hentoid.enums.Site;
import me.devsaki.hentoid.enums.StatusContent;
import me.devsaki.hentoid.events.DownloadEvent;
import me.devsaki.hentoid.events.ProcessEvent;
import me.devsaki.hentoid.events.ServiceDestroyedEvent;
import me.devsaki.hentoid.json.ContentV1;
Expand Down Expand Up @@ -156,6 +157,9 @@ private void startImport(boolean rename, boolean cleanNoJSON, boolean cleanNoIma
Content content = null;
List<LogUtil.LogEntry> log = new ArrayList<>();

// Stop downloads; it can get messy if downloading _and_ refresh / import happen at the same time
EventBus.getDefault().post(new DownloadEvent(DownloadEvent.EV_PAUSE));

final FileHelper.NameFilter imageNames = displayName -> ImageHelper.isImageExtensionSupported(FileHelper.getExtension(displayName));

DocumentFile rootFolder = FileHelper.getFolderFromTreeUriString(this, Preferences.getStorageUri());
Expand Down
Loading

0 comments on commit 42ef82d

Please sign in to comment.