Skip to content

Commit

Permalink
courses: update list after joining (fixes #2650) (#2651)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
Okuro3499 and dogi authored Oct 31, 2023
1 parent b60f8fa commit cc5fc2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1126
versionName "0.11.26"
versionCode 1127
versionName "0.11.27"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
Expand Down Expand Up @@ -232,7 +234,11 @@ private AlertDialog createAlertDialog() {
msg += getString(R.string.return_to_the_home_tab_to_access_mycourses);
builder.setMessage(msg);
builder.setCancelable(true);
builder.setPositiveButton(R.string.ok, (dialog, id) -> dialog.cancel());
builder.setPositiveButton(R.string.ok, (dialog, id) -> {
dialog.cancel();
CourseFragment newFragment = new CourseFragment();
recreateFragment(newFragment);
});
return builder.create();
}

Expand Down Expand Up @@ -312,4 +318,11 @@ public void onPause() {
super.onPause();
saveSearchActivity();
}

public void recreateFragment(Fragment fragment) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
}

0 comments on commit cc5fc2f

Please sign in to comment.