Skip to content

Commit

Permalink
Fixing some state issues and improving some code.
Browse files Browse the repository at this point in the history
  • Loading branch information
GottaGetSwifty committed Feb 17, 2016
1 parent 70ecc4d commit f156764
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
37 changes: 0 additions & 37 deletions app/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,43 +96,6 @@
android:name="activity.reading.StoryReadingActivity"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode"
android:theme="@style/MainTheme" />
<!--<activity-->
<!--android:name="activity.sharing.LoadActivity"-->
<!--android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode"-->
<!--android:theme="@style/MainTheme">-->
<!--<intent-filter android:label="@string/app_name">-->
<!--<action android:name="android.intent.action.VIEW" />-->

<!--<category android:name="android.intent.category.BROWSABLE" />-->
<!--<category android:name="android.intent.category.DEFAULT" />-->

<!--<data-->
<!--android:mimeType="application/octet-stream"-->
<!--android:pathPattern=".*\\.ufw"-->
<!--android:scheme="content" />-->
<!--</intent-filter>-->

<!--<intent-filter android:label="@string/app_name">-->
<!--<action android:name="android.intent.action.VIEW" />-->

<!--<category android:name="android.intent.category.DEFAULT" />-->

<!--<data android:scheme="file" />-->
<!--<data android:host="*" />-->
<!--<data android:pathPattern=".*\\.ufw" />-->
<!--</intent-filter>-->
<!--<intent-filter android:label="@string/app_name">-->
<!--<action android:name="android.intent.action.VIEW" />-->

<!--<category android:name="android.intent.category.DEFAULT" />-->

<!--<data-->
<!--android:host="*"-->
<!--android:mimeType="*/*"-->
<!--android:pathPattern=".*\\.ufw"-->
<!--android:scheme="file" />-->
<!--</intent-filter>-->
<!--</activity>-->
<activity
android:name="activity.sharing.ShareActivity"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode"
Expand Down
4 changes: 4 additions & 0 deletions app/app/src/main/java/eventbusmodels/BiblePagingEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public static BiblePagingEvent getStickyEvent(Context context){
else{
return event;
}
}

public static void refreshPagingEvent(Context context) {
BiblePagingEvent event = UWPreferenceDataAccessor.getSharedInstance(context).createBiblePagingEvent();
EventBus.getDefault().postSticky(event);
}
}
6 changes: 6 additions & 0 deletions app/app/src/main/java/eventbusmodels/StoriesPagingEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public StoriesPagingEvent(StoryPage mainStoryPage, StoryPage secondaryStoryPage)
}

public static StoriesPagingEvent getStickyEvent(Context context){

StoriesPagingEvent event = EventBus.getDefault().getStickyEvent(StoriesPagingEvent.class);
if(event == null){
event = UWPreferenceDataAccessor.getSharedInstance(context).createStoriesPagingEvent();
Expand All @@ -30,4 +31,9 @@ public static StoriesPagingEvent getStickyEvent(Context context){
return event;
}
}

public static void refreshPagingEvent(Context context) {
StoriesPagingEvent event = UWPreferenceDataAccessor.getSharedInstance(context).createStoriesPagingEvent();
EventBus.getDefault().postSticky(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -466,16 +466,17 @@ private void downloadVideo(final VersionViewModel viewModel){
getContext().startService(downloadIntent);
}

private void deleteText(VersionViewModel model){
private void deleteText(final VersionViewModel model){


final Version version = model.getVersion();
UWPreferenceDataManager.willDeleteVersion(getContext(), model.getVersion());
new AsyncTask<Void, Void, Void>(){

@Override
protected Void doInBackground(Void... params) {
final Version version = model.getVersion();
UWPreferenceDataManager.willDeleteVersion(getContext(), version);
version.deleteContent(getContext());
refreshData();
return null;
}

Expand All @@ -487,14 +488,16 @@ protected void onPostExecute(Void aVoid) {
}.execute();
}

private void deleteAudio(VersionViewModel model){
private void deleteAudio(final VersionViewModel model){


final Version version = model.getVersion();
new AsyncTask<Void, Void, Void>(){

@Override
protected Void doInBackground(Void... params) {
Version version = model.getVersion();
version.deleteAudio(getContext());
refreshData();
return null;
}

Expand All @@ -510,6 +513,11 @@ private void deleteVideo(VersionViewModel model){

}

private void refreshData() {
BiblePagingEvent.refreshPagingEvent(getApplicationContext());
StoriesPagingEvent.refreshPagingEvent(getApplicationContext());
}

@Override
public void resourceChosen(VersionViewModel.ResourceViewModel viewModel, Version version) {

Expand Down

0 comments on commit f156764

Please sign in to comment.