Skip to content

Commit

Permalink
NClientV2 2.5.3
Browse files Browse the repository at this point in the history
- Added translation for arabic blueprint
  • Loading branch information
Dar9586 committed Aug 1, 2020
1 parent acc12f3 commit 4241e0d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.dar.nclientv2"
minSdkVersion 14
targetSdkVersion 29
versionCode 253
versionName "2.5.3"
versionCode 254
versionName "2.5.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void triggerEndDownload(GalleryDownloaderV2 downloader) {
}

@Override
public void triggerStopDownlaod(GalleryDownloaderV2 downloader) {
public void triggerCancelDownload(GalleryDownloaderV2 downloader) {
removeDownloader(downloader);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;

public class DownloadGalleryV2 extends JobIntentService {
private static final Object lock=new Object();
private static final int JOB_DOWNLOAD_GALLERY_ID=9999;
public static void downloadGallery(Context context, GenericGallery gallery){
if(gallery.isValid() && gallery instanceof Gallery)downloadGallery(context,(Gallery) gallery);
Expand All @@ -43,6 +44,7 @@ private static void downloadGallery(Context context, Gallery gallery,int start,i

@Override
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
int startCommand=super.onStartCommand(intent, flags, startId);
if(intent!=null){
int id=intent.getIntExtra(getPackageName()+".ID",-1);
String mode=intent.getStringExtra(getPackageName()+".MODE");
Expand All @@ -62,7 +64,7 @@ public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
}
}
}
return super.onStartCommand(intent, flags, startId);
return startCommand;
}

public static void loadDownloads(Context context) {
Expand All @@ -86,14 +88,26 @@ public static void downloadRange(Context context, Gallery gallery, int start, in
public static void startWork(@Nullable Context context) {
if(context!=null)
enqueueWork(context,DownloadGalleryV2.class,JOB_DOWNLOAD_GALLERY_ID,new Intent());
synchronized (lock) {
lock.notify();
}
}

@Override
protected void onHandleWork(@NonNull Intent intent) {
while (true){
for(;;){
obtainData();
GalleryDownloaderManager entry = DownloadQueue.fetch();
if(entry==null)return;
if(entry==null){
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
continue;
}
LogUtility.d("Downloading: "+entry.downloader().getId());
if(entry.downloader().downloadGalleryData()){
entry.downloader().download();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ public interface DownloadObserver{
void triggerStartDownload(GalleryDownloaderV2 downloader);
void triggerUpdateProgress(GalleryDownloaderV2 downloader,int reach,int total);
void triggerEndDownload(GalleryDownloaderV2 downloader);
void triggerStopDownlaod(GalleryDownloaderV2 downloader);
void triggerCancelDownload(GalleryDownloaderV2 downloader);
void triggerPauseDownload(GalleryDownloaderV2 downloader);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void triggerEndDownload(GalleryDownloaderV2 downloader) {
}

@Override
public void triggerStopDownlaod(GalleryDownloaderV2 downloader) {
public void triggerCancelDownload(GalleryDownloaderV2 downloader) {
cancelNotification();
Global.recursiveDelete(downloader.getFolder());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void onUpdate(){
for(DownloadObserver observer:observers)observer.triggerUpdateProgress(this,reach,total);
}
private void onCancel(){
for(DownloadObserver observer:observers)observer.triggerStopDownlaod(this);
for(DownloadObserver observer:observers)observer.triggerCancelDownload(this);
}
private void onPause(){
for(DownloadObserver observer:observers)observer.triggerPauseDownload(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public CustomWebView(Context context, AttributeSet attrs) {
initialize();
}

@Override
public void loadUrl(String url) {
LogUtility.d("Loading url: "+url);
super.loadUrl(url);
}

public CustomWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
javaScriptInterface=new MyJavaScriptInterface(context.getApplicationContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public static void notify(String channel, int notificationId, Notification notif
notificationArray.add(notificationId);
trimArray();
LogUtility.d("Notification count: "+notificationArray.size());
notificationSettings.notificationManager.notify(null,notificationId,notification);
notificationSettings.notificationManager.notify(notificationId,notification);
}
public static void cancel(String channel, int notificationId){
notificationSettings.notificationManager.cancel(channel,notificationId);
notificationSettings.notificationManager.cancel(notificationId);
notificationArray.remove(Integer.valueOf(notificationId));
}
private static void trimArray(){
Expand Down

0 comments on commit 4241e0d

Please sign in to comment.