Cleanup before tagging 1.4.1 and add license to about page.

- Add missing separator in about "Special Thanks" section
- Add margin to separators in about page
- Moved registering and unregistering of receiver from onResume and onPause to onCreate and onDestroy in SplashActivity.java
- Better UX reaction to STATE_OFFLINE in MainActivity.java
- Remove redundant check for ApiClient in LoginService
- AbsMusicContentActivity calls onStateOffline() instead of handling navigation by itself.
This commit is contained in:
天クマ 2026-01-23 17:50:02 -03:00
commit 1f2ae7f1d9
8 changed files with 91 additions and 24 deletions

View file

@ -1,12 +1,9 @@
package org.adrianvictor.geleia.activities; package org.adrianvictor.geleia.activities;
import static org.adrianvictor.geleia.adapter.CustomFragmentStatePagerAdapter.TAG;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -23,6 +20,7 @@ import com.afollestad.materialcab.attached.AttachedCabKt;
import org.adrianvictor.geleia.activities.base.AbsMusicContentActivity; import org.adrianvictor.geleia.activities.base.AbsMusicContentActivity;
import org.adrianvictor.geleia.fragments.OfflineFragment; import org.adrianvictor.geleia.fragments.OfflineFragment;
import org.adrianvictor.geleia.interfaces.CabHolder; import org.adrianvictor.geleia.interfaces.CabHolder;
import org.adrianvictor.geleia.util.NavigationUtil;
import org.adrianvictor.geleia.util.PreferenceUtil; import org.adrianvictor.geleia.util.PreferenceUtil;
import org.adrianvictor.geleia.util.ThemeUtil; import org.adrianvictor.geleia.util.ThemeUtil;
import org.adrianvictor.geleia.databinding.ActivityMainContentBinding; import org.adrianvictor.geleia.databinding.ActivityMainContentBinding;
@ -105,7 +103,6 @@ public class MainActivity extends AbsMusicContentActivity implements CabHolder {
@Override @Override
public void onStateOffline() { public void onStateOffline() {
Log.d(TAG, "onStateOffline() foi chamado.");
Menu menu = binding.navigationView.getMenu(); Menu menu = binding.navigationView.getMenu();
menu.clear(); menu.clear();
@ -118,7 +115,11 @@ public class MainActivity extends AbsMusicContentActivity implements CabHolder {
setUpDrawerLayout(); setUpDrawerLayout();
pendingShowOffline = true; if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
NavigationUtil.startUnreachable(this);
} else {
pendingShowOffline = true;
}
} }
@Override @Override

View file

@ -45,20 +45,6 @@ public class SplashActivity extends AbsBaseActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
}
@Override
public void onPause() {
super.onPause();
unregisterReceiver(receiver);
overridePendingTransition(0, R.anim.fade_delay);
}
@Override
protected void onResume() {
super.onResume();
final IntentFilter filter = new IntentFilter(); final IntentFilter filter = new IntentFilter();
filter.addAction(LoginService.STATE_ONLINE); filter.addAction(LoginService.STATE_ONLINE);
filter.addAction(LoginService.STATE_OFFLINE); filter.addAction(LoginService.STATE_OFFLINE);
@ -69,6 +55,19 @@ public class SplashActivity extends AbsBaseActivity {
registerReceiver(receiver, filter); registerReceiver(receiver, filter);
} }
setContentView(R.layout.activity_splash);
}
@Override
public void onPause() {
super.onPause();
overridePendingTransition(0, R.anim.fade_delay);
}
@Override
protected void onResume() {
super.onResume();
User user = App.getDatabase().userDao().getUser(PreferenceUtil.getInstance(this).getUser()); User user = App.getDatabase().userDao().getUser(PreferenceUtil.getInstance(this).getUser());
List<User> available = App.getDatabase().userDao().getUsers(); List<User> available = App.getDatabase().userDao().getUsers();
@ -82,4 +81,10 @@ public class SplashActivity extends AbsBaseActivity {
startService(new Intent(this, LoginService.class)); startService(new Intent(this, LoginService.class));
} }
} }
@Override
protected void onDestroy() {
unregisterReceiver(receiver);
super.onDestroy();
}
} }

View file

@ -29,7 +29,7 @@ public abstract class AbsMusicContentActivity extends AbsMusicPanelActivity impl
onStateOnline(); onStateOnline();
break; break;
case LoginService.STATE_OFFLINE: case LoginService.STATE_OFFLINE:
NavigationUtil.startSelect(context); onStateOffline();
break; break;
} }
} }

View file

@ -59,11 +59,6 @@ public class LoginService extends Service {
} }
} }
if (App.getApiClient() == null) {
sendBroadcast(new Intent(STATE_OFFLINE));
return;
}
App.getApiClient().ChangeServerLocation(user.server); App.getApiClient().ChangeServerLocation(user.server);
App.getApiClient().SetAuthenticationInfo(user.token, user.id); App.getApiClient().SetAuthenticationInfo(user.token, user.id);
App.getApiClient().GetSystemInfoAsync(new Response<SystemInfo>() { App.getApiClient().GetSystemInfoAsync(new Response<SystemInfo>() {

View file

@ -82,6 +82,50 @@
</LinearLayout> </LinearLayout>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="?attr/rectSelector"-->
<!-- android:clickable="true"-->
<!-- android:focusable="true"-->
<!-- android:gravity="center_vertical"-->
<!-- android:minHeight="@dimen/item_height"-->
<!-- android:orientation="horizontal"-->
<!-- android:paddingLeft="16dp"-->
<!-- android:paddingRight="16dp">-->
<!-- <org.adrianvictor.geleia.views.IconImageView-->
<!-- android:id="@+id/icon_license"-->
<!-- android:layout_width="24dp"-->
<!-- android:layout_height="24dp"-->
<!-- app:srcCompat="@android:drawable/ic_lock_idle_lock"-->
<!-- tools:ignore="ContentDescription" />-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="32dp"-->
<!-- android:orientation="vertical"-->
<!-- android:paddingBottom="8dp"-->
<!-- android:paddingTop="8dp">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="@string/license"-->
<!-- android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />-->
<!-- <TextView-->
<!-- android:id="@+id/app_license"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textAppearance="@style/TextAppearance.AppCompat.Caption"-->
<!-- tools:text="@string/application_license" />-->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
<LinearLayout <LinearLayout
android:id="@+id/app_source" android:id="@+id/app_source"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -113,6 +157,14 @@
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAlignment="center"
android:text="@string/application_license" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -27,7 +27,8 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dividerColor" /> android:layout_marginBottom="10dp"
android:background="?attr/dividerColor"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -76,6 +77,12 @@
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="?attr/dividerColor" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -134,6 +141,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="?attr/dividerColor" /> android:background="?attr/dividerColor" />
<LinearLayout <LinearLayout
@ -186,6 +194,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="?attr/dividerColor" /> android:background="?attr/dividerColor" />
<LinearLayout <LinearLayout
@ -238,6 +247,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="?attr/dividerColor" /> android:background="?attr/dividerColor" />
<LinearLayout <LinearLayout
@ -298,6 +308,7 @@
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="?attr/dividerColor" /> android:background="?attr/dividerColor" />
<LinearLayout <LinearLayout

View file

@ -27,7 +27,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large" /> android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<TextView <TextView
android:id="@+id/error_messsage" android:id="@+id/error_message"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/error_title" android:layout_below="@id/error_title"

View file

@ -241,5 +241,8 @@
<string name="oops">Oops! I did it again...</string> <string name="oops">Oops! I did it again...</string>
<string name="sad_face">;(</string> <string name="sad_face">;(</string>
<string name="server_is_unreachable">Sorry, but we couldn\'t reach this server right now.</string> <string name="server_is_unreachable">Sorry, but we couldn\'t reach this server right now.</string>
<string name="license">License</string>
<string name="app_license">GNU General Public License v3.0</string>
<string name="application_license">GNU General Public License v3.0</string>
</resources> </resources>