Skip to content

Commit

Permalink
Upgrade to version 2.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ham3da committed Apr 6, 2022
1 parent 9070c7c commit 0e31484
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 257 deletions.
10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "ir.ham3da.darya"
minSdkVersion 21
targetSdkVersion 31
versionCode 44
versionName "2.8.4"
versionCode 48
versionName "2.8.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -40,12 +40,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "androidx.appcompat:appcompat:1.4.0"
implementation "androidx.appcompat:appcompat:1.4.1"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
Expand All @@ -56,16 +56,16 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics'

implementation 'com.mindorks.android:prdownloader:0.6.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'

//implementation group: 'commons-io', name: 'commons-io', version: '20030203.000550'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.koji-1009:ChronoDialogPreference:2.1.0'
implementation 'com.google.android.play:core:1.10.2'
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference:1.2.0'
}
64 changes: 0 additions & 64 deletions app/src/main/assets/donate_en.htm

This file was deleted.

62 changes: 0 additions & 62 deletions app/src/main/assets/donate_fa.htm

This file was deleted.

90 changes: 45 additions & 45 deletions app/src/main/java/ir/ham3da/darya/ActivityAudioCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import ir.ham3da.darya.utility.AppSettings;



import ir.ham3da.darya.ganjoor.GanjoorAudioInfo;
import ir.ham3da.darya.utility.MyDialogs;
import ir.ham3da.darya.utility.PoemAudio;
Expand Down Expand Up @@ -199,6 +198,7 @@ private void reloadItems()
scrollListener.resetState();
loadItems();
}

private void downloadMarkedAudio()
{
scheduleAudioList = new ArrayList<>();
Expand Down Expand Up @@ -684,23 +684,24 @@ public void loadItems()
}

this.page_number = calc_page_num();
Log.e(TAG, " this.page_number: "+ this.page_number);
Log.e(TAG, " this.page_number: " + this.page_number);
downloadJsonPoemAudios(getAudioListUrl(dl_type));
}

private int calc_page_num()
{
if(can_load_new_page())
if (can_load_new_page())
{
double newPage = ((double) listXmlItems.size() / page_size) +1;
double newPage = ((double) listXmlItems.size() / page_size) + 1;
int newPage2 = (int) Math.ceil(newPage);
return newPage2;
}
else
{
return 1;
return 1;
}
}

private boolean can_load_new_page()
{
return (listXmlItems != null && listXmlItems.size() >= page_size);
Expand All @@ -715,28 +716,28 @@ private boolean can_load_new_page()
private boolean checkExistAudio(GanjoorAudioInfo ganjoorAudioInfo)
{
boolean result = false;
if (dl_type == GanjoorAudioInfo.DOWNLOAD_POEM)
boolean existInDatabase = _DbBrowser.IsSoundExist(ganjoorAudioInfo.audio_fchecksum);
boolean fileExist = _DbBrowser.checkAudioFileExist(ganjoorAudioInfo.audio_fchecksum, dl_path);

if (existInDatabase)
{
for (PoemAudio PoemAudio1 : existAudioList)
if (fileExist)
{
if (PoemAudio1.poemID == ganjoorAudioInfo.audio_post_ID && ganjoorAudioInfo.audio_fchecksum.equals(PoemAudio1.fchksum))
{
result = true;
break;
}

result = true;
}
if(!result)
else
{
reAddSoundData(ganjoorAudioInfo);
_DbBrowser.deleteSound(ganjoorAudioInfo.audio_fchecksum);
result = false;
}

}
else
{
result = _DbBrowser.checkAudioFileExist(ganjoorAudioInfo.audio_fchecksum, dl_path);
if(result)
if (fileExist)
{
reAddSoundData(ganjoorAudioInfo);
result = true;
}
}

Expand All @@ -746,14 +747,13 @@ private boolean checkExistAudio(GanjoorAudioInfo ganjoorAudioInfo)

private void reAddSoundData(GanjoorAudioInfo ganjoorAudioInfo)
{
if(!_DbBrowser.IsSoundExist(ganjoorAudioInfo.audio_fchecksum))
if (!_DbBrowser.IsSoundExist(ganjoorAudioInfo.audio_fchecksum))
{
_DbBrowser.addToSound(ganjoorAudioInfo);
}
}



private void downloadJsonPoemAudios(String jsonUrl)
{

Expand Down Expand Up @@ -785,13 +785,13 @@ private void parseAudioListJsonData(String JsonString)
try
{
JSONArray jsonArray = new JSONArray(JsonString);
if(jsonArray.length() > 0)
if (jsonArray.length() > 0)
{
List<GanjoorAudioInfo> ganjoorAudioInfos1 = new ArrayList<>();
int new_index = 0;
if(listXmlItems != null)
if (listXmlItems != null)
{
new_index = listXmlItems.size();
new_index = listXmlItems.size();
}

for (int i = 0; i < jsonArray.length(); i++)
Expand Down Expand Up @@ -827,7 +827,7 @@ private void parseAudioListJsonData(String JsonString)

new_index++;
GanjoorAudioInfo ganjoorAudioInfo1 = new GanjoorAudioInfo(audio_post_ID, audio_order,
audio_xml,null, audio_mp3, audio_title, audio_artist,
audio_xml, null, audio_mp3, audio_title, audio_artist,
audio_artist_url, audio_src, audio_src_url, audio_guid,
audio_fchecksum, audio_mp3bsize, audio_oggbsize, audio_date, false,
new_index, false);
Expand Down Expand Up @@ -861,32 +861,32 @@ private void parseAudioListJsonData(String JsonString)
}


no_item_textview.setVisibility(View.GONE);

if (listXmlItems == null)
{
Log.e(TAG, "parseAudioListJsonData: listXmlItems is null");
listXmlItems = ganjoorAudioInfos1;
GanjoorPoet ganjoorPoet = null;
if (dl_type == GanjoorAudioInfo.DOWNLOAD_POET_POEMS)
{
ganjoorPoet = _DbBrowser.getPoet(poet_id);
}
adaptorAudio = new AdaptorAudio(listXmlItems, this, dl_type, ganjoorPoet);
recycler_audio.setAdapter(adaptorAudio);
recycler_audio.scrollToPosition(0);
}
else
{
Log.e(TAG, "parseAudioListJsonData: listXmlItems is not null");
listXmlItems.addAll(ganjoorAudioInfos1);
this.adaptorAudio.notifyItemRangeInserted(this.listXmlItems.size(), this.listXmlItems.size() - 1);
}
no_item_textview.setVisibility(View.GONE);

if (listXmlItems == null)
{
Log.e(TAG, "parseAudioListJsonData: listXmlItems is null");
listXmlItems = ganjoorAudioInfos1;
GanjoorPoet ganjoorPoet = null;
if (dl_type == GanjoorAudioInfo.DOWNLOAD_POET_POEMS)
{
ganjoorPoet = _DbBrowser.getPoet(poet_id);
}
adaptorAudio = new AdaptorAudio(listXmlItems, this, dl_type, ganjoorPoet);
recycler_audio.setAdapter(adaptorAudio);
recycler_audio.scrollToPosition(0);
}
else
{
Log.e(TAG, "parseAudioListJsonData: listXmlItems is not null");
listXmlItems.addAll(ganjoorAudioInfos1);
this.adaptorAudio.notifyItemRangeInserted(this.listXmlItems.size(), this.listXmlItems.size() - 1);
}


}
else{
else
{
Toast.makeText(this, getString(R.string.nothing_found), Toast.LENGTH_SHORT).show();
}

Expand Down
Loading

0 comments on commit 0e31484

Please sign in to comment.