Customize instances

This commit is contained in:
Thomas 2022-05-09 10:25:07 +02:00
parent a9286ab150
commit 45b35d0718
36 changed files with 476 additions and 40 deletions

View File

@ -193,7 +193,6 @@ dependencies {
google_acadImplementation "com.google.android.gms:play-services-cast:21.0.1" google_acadImplementation "com.google.android.gms:play-services-cast:21.0.1"
google_acadImplementation "androidx.mediarouter:mediarouter:1.3.0" google_acadImplementation "androidx.mediarouter:mediarouter:1.3.0"
google_acadImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1' google_acadImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1'
google_acadImplementation 'com.github.evozi:Cyanea:1.0.7'
google_fullImplementation "com.google.android.gms:play-services-cast-tv:19.0.1" google_fullImplementation "com.google.android.gms:play-services-cast-tv:19.0.1"
google_fullImplementation "com.google.android.gms:play-services-cast:21.0.1" google_fullImplementation "com.google.android.gms:play-services-cast:21.0.1"

View File

@ -16,9 +16,6 @@ package app.fedilab.fedilabtube;
import com.jaredrummler.cyanea.Cyanea;
import org.matomo.sdk.Matomo; import org.matomo.sdk.Matomo;
import org.matomo.sdk.Tracker; import org.matomo.sdk.Tracker;
import org.matomo.sdk.TrackerBuilder; import org.matomo.sdk.TrackerBuilder;
@ -32,7 +29,6 @@ public class FedilabTube extends BaseFedilabTube {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Cyanea.init(this, getResources());
} }
public synchronized Tracker getTracker() { public synchronized Tracker getTracker() {

View File

@ -15,9 +15,10 @@ package app.fedilab.fedilabtube.activities;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.os.Bundle; import android.os.Bundle;
import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
public class BaseActivity extends CyaneaAppCompatActivity {
public class BaseActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View File

@ -0,0 +1,138 @@
<resources>
<attr name="backgroundView" format="color" />
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppThemeNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- Institutionnel theme. -->
<style name="Institutionnel" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
<item name="colorAccent">@color/colorAccent_institutionnel</item>
</style>
<style name="InstitutionnelNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
<item name="colorAccent">@color/colorAccent_institutionnel</item>
</style>
<!-- Maternelle theme. -->
<style name="Maternelle" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
<item name="colorAccent">@color/colorAccent_maternelle</item>
</style>
<style name="MaternelleNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
<item name="colorAccent">@color/colorAccent_maternelle</item>
</style>
<!-- Art theme. -->
<style name="Art" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_art</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
<item name="colorAccent">@color/colorAccent_art</item>
</style>
<style name="ArtNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_art</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
<item name="colorAccent">@color/colorAccent_art</item>
</style>
<!-- Sciences theme. -->
<style name="Sciences" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_sciences</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
<item name="colorAccent">@color/colorAccent_sciences</item>
</style>
<style name="SciencesNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_sciences</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
<item name="colorAccent">@color/colorAccent_sciences</item>
</style>
<!-- Education theme. -->
<style name="Education" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_education</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
<item name="colorAccent">@color/colorAccent_education</item>
</style>
<style name="EducationNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_education</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
<item name="colorAccent">@color/colorAccent_education</item>
</style>
<!-- Enseignement Pro theme. -->
<style name="EnseignementPro" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
</style>
<style name="EnseignementProNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
</style>
<!-- Langues theme. -->
<style name="Langues" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_langues</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
<item name="colorAccent">@color/colorAccent_langues</item>
</style>
<style name="LanguesNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_langues</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
<item name="colorAccent">@color/colorAccent_langues</item>
</style>
<!-- ActionEducative theme. -->
<style name="ActionEducative" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
<item name="colorAccent">@color/colorAccent_action_educative</item>
</style>
<style name="ActionEducativeNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
<item name="colorAccent">@color/colorAccent_action_educative</item>
</style>
<!-- Cycle 2 theme. -->
<style name="Cycle2" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
<item name="colorAccent">@color/colorAccent_cycle2</item>
</style>
<style name="Cycle2NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
<item name="colorAccent">@color/colorAccent_cycle2</item>
</style>
<!-- Cycle 3 theme. -->
<style name="Cycle3" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
<item name="colorAccent">@color/colorAccent_cycle3</item>
</style>
<style name="Cycle3NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
<item name="colorAccent">@color/colorAccent_cycle3</item>
</style>
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" />
<style name="progress" parent="SpinKitView.Circle" />
<style name="progressBottom" parent="SpinKitView.ThreeBounce" />
<style name="searchBarSepia" parent="MaterialSearchBarDark" />
</resources>

View File

@ -1,9 +1,51 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#512DA8</color> <color name="colorPrimary">#512DA8</color>
<color name="colorPrimaryDark">#4527A0</color> <color name="colorPrimaryDark">#4527A0</color>
<color name="colorAccent">#9C27B0</color> <color name="colorAccent">#9C27B0</color>
<!-- Institutionnel -->
<color name="colorPrimary_institutionnel">#1B2E35</color>
<color name="colorPrimaryDark_institutionnel">#1B2E35</color>
<color name="colorAccent_institutionnel">#35A8E0</color>
<!-- maternelle -->
<color name="colorPrimary_maternelle">#341047</color>
<color name="colorPrimaryDark_maternelle">#341047</color>
<color name="colorAccent_maternelle">#D3135D</color>
<!-- art -->
<color name="colorPrimary_art">#0d3b5f</color>
<color name="colorPrimaryDark_art">#0d3b5f</color>
<color name="colorAccent_art">#E61B72</color>
<!-- sciences -->
<color name="colorPrimary_sciences">#0d3b5f</color>
<color name="colorPrimaryDark_sciences">#0d3b5f</color>
<color name="colorAccent_sciences">#59b700</color>
<!-- education -->
<color name="colorPrimary_education">#0d3b5f</color>
<color name="colorPrimaryDark_education">#0d3b5f</color>
<color name="colorAccent_education">#EA3700</color>
<!-- enseignement pro -->
<color name="colorPrimary_enseignement_pro">#0d3b5f</color>
<color name="colorPrimaryDark_enseignement_pro">#0d3b5f</color>
<color name="colorAccent_enseignement_pro">#730FBA</color>
<!-- langues -->
<color name="colorPrimary_langues">#0d3b5f</color>
<color name="colorPrimaryDark_langues">#0d3b5f</color>
<color name="colorAccent_langues">#F69622</color>
<!-- Action éducative -->
<color name="colorPrimary_action_educative">#1B2E35</color>
<color name="colorPrimaryDark_action_educative">#1B2E35</color>
<color name="colorAccent_action_educative">#E52928</color>
<!-- cycle2 -->
<color name="colorPrimary_cycle2">#341047</color>
<color name="colorPrimaryDark_cycle2">#341047</color>
<color name="colorAccent_cycle2">#39A935</color>
<!-- cycle3 -->
<color name="colorPrimary_cycle3">#341047</color>
<color name="colorPrimaryDark_cycle3">#341047</color>
<color name="colorAccent_cycle3">#C1661B</color>
<color name="tag_color">#bbF2690D</color> <color name="tag_color">#bbF2690D</color>
<color name="tag_color_text">#FAFAFA</color> <color name="tag_color_text">#FAFAFA</color>
<color name="positive_thumbs">#2b90d9</color> <color name="positive_thumbs">#2b90d9</color>

View File

@ -1,23 +1,136 @@
<resources> <resources>
<attr name="backgroundView" format="color" /> <attr name="backgroundView" format="color" />
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.Cyanea.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> </style>
<style name="AppThemeNoActionBar" parent="Theme.Cyanea.Dark.NoActionBar"> <style name="AppThemeNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> </style>
<style name="theme" parent="@style/Theme.Cyanea.Dark" /> <!-- Institutionnel theme. -->
<style name="Institutionnel" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
<item name="colorAccent">@color/colorAccent_institutionnel</item>
</style>
<style name="InstitutionnelNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_institutionnel</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_institutionnel</item>
<item name="colorAccent">@color/colorAccent_institutionnel</item>
</style>
<!-- Maternelle theme. -->
<style name="Maternelle" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
<item name="colorAccent">@color/colorAccent_maternelle</item>
</style>
<style name="MaternelleNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_maternelle</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_maternelle</item>
<item name="colorAccent">@color/colorAccent_maternelle</item>
</style>
<!-- Art theme. -->
<style name="Art" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_art</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
<item name="colorAccent">@color/colorAccent_art</item>
</style>
<style name="ArtNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_art</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_art</item>
<item name="colorAccent">@color/colorAccent_art</item>
</style>
<!-- Sciences theme. -->
<style name="Sciences" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_sciences</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
<item name="colorAccent">@color/colorAccent_sciences</item>
</style>
<style name="SciencesNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_sciences</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_sciences</item>
<item name="colorAccent">@color/colorAccent_sciences</item>
</style>
<!-- Education theme. -->
<style name="Education" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_education</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
<item name="colorAccent">@color/colorAccent_education</item>
</style>
<style name="EducationNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_education</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_education</item>
<item name="colorAccent">@color/colorAccent_education</item>
</style>
<!-- Enseignement Pro theme. -->
<style name="EnseignementPro" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
</style>
<style name="EnseignementProNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_enseignement_pro</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_enseignement_pro</item>
<item name="colorAccent">@color/colorAccent_enseignement_pro</item>
</style>
<!-- Langues theme. -->
<style name="Langues" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_langues</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
<item name="colorAccent">@color/colorAccent_langues</item>
</style>
<style name="LanguesNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_langues</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_langues</item>
<item name="colorAccent">@color/colorAccent_langues</item>
</style>
<!-- ActionEducative theme. -->
<style name="ActionEducative" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
<item name="colorAccent">@color/colorAccent_action_educative</item>
</style>
<style name="ActionEducativeNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_action_educative</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_action_educative</item>
<item name="colorAccent">@color/colorAccent_action_educative</item>
</style>
<!-- Cycle 2 theme. -->
<style name="Cycle2" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
<item name="colorAccent">@color/colorAccent_cycle2</item>
</style>
<style name="Cycle2NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle2</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle2</item>
<item name="colorAccent">@color/colorAccent_cycle2</item>
</style>
<!-- Cycle 3 theme. -->
<style name="Cycle3" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
<item name="colorAccent">@color/colorAccent_cycle3</item>
</style>
<style name="Cycle3NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary_cycle3</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark_cycle3</item>
<item name="colorAccent">@color/colorAccent_cycle3</item>
</style>
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
<style name="popupTheme" parent="@style/Theme.Cyanea.Light" /> <style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" />
<style name="progress" parent="SpinKitView.Circle" /> <style name="progress" parent="SpinKitView.Circle" />
<style name="progressBottom" parent="SpinKitView.ThreeBounce" /> <style name="progressBottom" parent="SpinKitView.ThreeBounce" />
<style name="searchBarSepia" parent="MaterialSearchBarLight" /> <style name="searchBarSepia" parent="MaterialSearchBarDark" />
</resources> </resources>

View File

@ -24,6 +24,31 @@
<item name="android:colorBackground">@android:color/black</item> <item name="android:colorBackground">@android:color/black</item>
</style> </style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">?attr/colorOnBackground</item>
<item name="backgroundView">@color/backgroundDark</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="android:colorBackground">@android:color/black</item>
</style>
<style name="AppThemeNoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="backgroundView">@color/backgroundDark</item>
<item name="android:textColor">?attr/colorOnBackground</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="android:colorBackground">@android:color/black</item>
</style>
<style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" /> <style name="theme" parent="@style/ThemeOverlay.AppCompat.Dark" />
<style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" /> <style name="popupTheme" parent="@style/ThemeOverlay.AppCompat.Dark" />

View File

@ -28,19 +28,21 @@ import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import app.fedilab.fedilabtube.BuildConfig; import app.fedilab.fedilabtube.BuildConfig;
import app.fedilab.fedilabtube.R; import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance;
public class AboutActivity extends BaseActivity { public class AboutActivity extends BaseActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about); setContentView(R.layout.activity_about);

View File

@ -33,7 +33,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -53,6 +52,7 @@ import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment; import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment; import app.fedilab.fedilabtube.fragment.DisplayNotificationsFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.helper.SwitchAccountHelper; import app.fedilab.fedilabtube.helper.SwitchAccountHelper;
import app.fedilab.fedilabtube.sqlite.AccountDAO; import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite; import app.fedilab.fedilabtube.sqlite.Sqlite;
@ -65,8 +65,8 @@ public class AccountActivity extends BaseActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityAccountBinding.inflate(getLayoutInflater()); binding = ActivityAccountBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();
setContentView(view); setContentView(view);

View File

@ -35,6 +35,8 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist; import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist;
import app.fedilab.fedilabtube.client.data.VideoPlaylistData; import app.fedilab.fedilabtube.client.data.VideoPlaylistData;
import app.fedilab.fedilabtube.drawer.PlaylistAdapter; import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM; import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
@ -46,10 +48,11 @@ public class AllLocalPlaylistsActivity extends BaseActivity implements PlaylistA
private RelativeLayout textviewNoAction; private RelativeLayout textviewNoAction;
private List<Playlist> playlists; private List<Playlist> playlists;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_playlist); setContentView(R.layout.activity_all_playlist);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)

View File

@ -66,6 +66,8 @@ import app.fedilab.fedilabtube.databinding.ActivityAllPlaylistBinding;
import app.fedilab.fedilabtube.databinding.AddPlaylistBinding; import app.fedilab.fedilabtube.databinding.AddPlaylistBinding;
import app.fedilab.fedilabtube.drawer.PlaylistAdapter; import app.fedilab.fedilabtube.drawer.PlaylistAdapter;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM; import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import app.fedilab.fedilabtube.viewmodel.PlaylistsVM; import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -86,10 +88,11 @@ public class AllPlaylistsActivity extends BaseActivity implements PlaylistAdapte
private Uri inputData; private Uri inputData;
private ActivityAllPlaylistBinding binding; private ActivityAllPlaylistBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
binding = ActivityAllPlaylistBinding.inflate(getLayoutInflater()); binding = ActivityAllPlaylistBinding.inflate(getLayoutInflater());
View viewRoot = binding.getRoot(); View viewRoot = binding.getRoot();
setContentView(viewRoot); setContentView(viewRoot);

View File

@ -46,6 +46,8 @@ import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.data.InstanceData; import app.fedilab.fedilabtube.client.data.InstanceData;
import app.fedilab.fedilabtube.client.entities.InstanceParams; import app.fedilab.fedilabtube.client.entities.InstanceParams;
import app.fedilab.fedilabtube.drawer.InstanceAdapter; import app.fedilab.fedilabtube.drawer.InstanceAdapter;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan; import app.fedilab.fedilabtube.helper.RoundedBackgroundSpan;
import app.fedilab.fedilabtube.viewmodel.InstancesVM; import app.fedilab.fedilabtube.viewmodel.InstancesVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -65,10 +67,11 @@ public class InstancePickerActivity extends BaseActivity {
private TextView categories_view, languages_view; private TextView categories_view, languages_view;
private InstancesVM viewModel; private InstancesVM viewModel;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -25,6 +25,8 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.data.PlaylistData; import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -35,7 +37,7 @@ public class LocalPlaylistsActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -66,9 +66,12 @@ public class LoginActivity extends BaseActivity {
private ActivityLoginBinding binding; private ActivityLoginBinding binding;
private String acadInstance; private String acadInstance;
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityLoginBinding.inflate(getLayoutInflater()); binding = ActivityLoginBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();

View File

@ -16,6 +16,7 @@ package app.fedilab.fedilabtube.activities;
import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.NORMAL; import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.NORMAL;
import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.SURFING; import static app.fedilab.fedilabtube.activities.MainActivity.TypeOfConnection.SURFING;
import static app.fedilab.fedilabtube.helper.Helper.TAG;
import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation; import static app.fedilab.fedilabtube.helper.Helper.peertubeInformation;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
@ -28,6 +29,7 @@ import android.net.Uri;
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;
@ -227,7 +229,10 @@ public class MainActivity extends BaseMainActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
Log.v(TAG, "--> " + (true?R.style.ActionEducativeNoActionBar:R.style.ActionEducative));
HelperInstance.setTheme(MainActivity.this, HelperInstance.getLiveInstance(this),true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = super.binding; binding = super.binding;
Toolbar toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);

View File

@ -38,6 +38,8 @@ import app.fedilab.fedilabtube.client.data.InstanceData;
import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding; import app.fedilab.fedilabtube.databinding.ActivityManageInstancesBinding;
import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter; import app.fedilab.fedilabtube.drawer.AboutInstanceAdapter;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.sqlite.Sqlite; import app.fedilab.fedilabtube.sqlite.Sqlite;
import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO; import app.fedilab.fedilabtube.sqlite.StoredInstanceDAO;
import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM; import app.fedilab.fedilabtube.viewmodel.InfoInstanceVM;
@ -49,8 +51,10 @@ public class ManageInstancesActivity extends BaseActivity implements AboutInstan
private List<InstanceData.AboutInstance> aboutInstances; private List<InstanceData.AboutInstance> aboutInstances;
private AboutInstanceAdapter aboutInstanceAdapter; private AboutInstanceAdapter aboutInstanceAdapter;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityManageInstancesBinding.inflate(getLayoutInflater()); binding = ActivityManageInstancesBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();

View File

@ -41,6 +41,8 @@ import app.fedilab.fedilabtube.client.entities.OauthParams;
import app.fedilab.fedilabtube.client.entities.Token; import app.fedilab.fedilabtube.client.entities.Token;
import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI; import app.fedilab.fedilabtube.client.mastodon.RetrofitMastodonAPI;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -79,8 +81,8 @@ public class MastodonWebviewConnectActivity extends BaseActivity {
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview_connect); setContentView(R.layout.activity_webview_connect);
Bundle b = getIntent().getExtras(); Bundle b = getIntent().getExtras();
if (b != null) { if (b != null) {

View File

@ -56,6 +56,8 @@ import app.fedilab.fedilabtube.client.entities.UserMe;
import app.fedilab.fedilabtube.client.entities.UserSettings; import app.fedilab.fedilabtube.client.entities.UserSettings;
import app.fedilab.fedilabtube.databinding.ActivityMyAccountSettingsBinding; import app.fedilab.fedilabtube.databinding.ActivityMyAccountSettingsBinding;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.worker.WorkHelper; import app.fedilab.fedilabtube.worker.WorkHelper;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -67,8 +69,10 @@ public class MyAccountActivity extends BaseActivity {
private String fileName; private String fileName;
private NotificationSettings notificationSettings; private NotificationSettings notificationSettings;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityMyAccountSettingsBinding.inflate(getLayoutInflater()); binding = ActivityMyAccountSettingsBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();

View File

@ -159,6 +159,7 @@ import app.fedilab.fedilabtube.drawer.MenuAdapter;
import app.fedilab.fedilabtube.drawer.MenuItemAdapter; import app.fedilab.fedilabtube.drawer.MenuItemAdapter;
import app.fedilab.fedilabtube.helper.CacheDataSourceFactory; import app.fedilab.fedilabtube.helper.CacheDataSourceFactory;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance; import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.sqlite.AccountDAO; import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite; import app.fedilab.fedilabtube.sqlite.Sqlite;
@ -292,8 +293,10 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
public void onStreamStopped() { public void onStreamStopped() {
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = super.binding; binding = super.binding;
videoOrientationType = videoOrientation.LANDSCAPE; videoOrientationType = videoOrientation.LANDSCAPE;

View File

@ -60,6 +60,8 @@ import app.fedilab.fedilabtube.client.entities.ItemStr;
import app.fedilab.fedilabtube.client.entities.VideoParams; import app.fedilab.fedilabtube.client.entities.VideoParams;
import app.fedilab.fedilabtube.databinding.ActivityPeertubeEditBinding; import app.fedilab.fedilabtube.databinding.ActivityPeertubeEditBinding;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM; import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import app.fedilab.fedilabtube.viewmodel.MyVideoVM; import app.fedilab.fedilabtube.viewmodel.MyVideoVM;
import app.fedilab.fedilabtube.viewmodel.PostActionsVM; import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
@ -83,8 +85,10 @@ public class PeertubeEditUploadActivity extends BaseActivity {
private ActivityPeertubeEditBinding binding; private ActivityPeertubeEditBinding binding;
private Uri inputData; private Uri inputData;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityPeertubeEditBinding.inflate(getLayoutInflater()); binding = ActivityPeertubeEditBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();

View File

@ -52,11 +52,12 @@ public class PeertubeRegisterActivity extends BaseActivity {
private String instance; private String instance;
private ActivityRegisterPeertubeBinding binding; private ActivityRegisterPeertubeBinding binding;
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityRegisterPeertubeBinding.inflate(getLayoutInflater()); binding = ActivityRegisterPeertubeBinding.inflate(getLayoutInflater());
View mainView = binding.getRoot(); View mainView = binding.getRoot();
setContentView(mainView); setContentView(mainView);

View File

@ -66,6 +66,7 @@ import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.entities.UserMe; import app.fedilab.fedilabtube.client.entities.UserMe;
import app.fedilab.fedilabtube.databinding.ActivityPeertubeUploadBinding; import app.fedilab.fedilabtube.databinding.ActivityPeertubeUploadBinding;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance; import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM; import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -83,10 +84,11 @@ public class PeertubeUploadActivity extends BaseActivity {
private HashMap<String, String> channelToSend; private HashMap<String, String> channelToSend;
private ActivityPeertubeUploadBinding binding; private ActivityPeertubeUploadBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -26,6 +26,8 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.data.PlaylistData; import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.helper.PlaylistExportHelper; import app.fedilab.fedilabtube.helper.PlaylistExportHelper;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -35,10 +37,11 @@ public class PlaylistsActivity extends BaseActivity {
private final int PICK_IMPORT = 5556; private final int PICK_IMPORT = 5556;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -34,6 +34,8 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.databinding.ActivitySearchResultBinding; import app.fedilab.fedilabtube.databinding.ActivitySearchResultBinding;
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment; import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -45,6 +47,7 @@ public class SearchActivity extends BaseActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivitySearchResultBinding.inflate(getLayoutInflater()); binding = ActivitySearchResultBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();

View File

@ -45,6 +45,8 @@ import app.fedilab.fedilabtube.client.entities.SepiaSearch;
import app.fedilab.fedilabtube.databinding.ActivitySepiaSearchBinding; import app.fedilab.fedilabtube.databinding.ActivitySepiaSearchBinding;
import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment; import app.fedilab.fedilabtube.fragment.DisplaySepiaSearchFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
public class SepiaSearchActivity extends BaseActivity { public class SepiaSearchActivity extends BaseActivity {
@ -54,10 +56,11 @@ public class SepiaSearchActivity extends BaseActivity {
private ActivitySepiaSearchBinding binding; private ActivitySepiaSearchBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivitySepiaSearchBinding.inflate(getLayoutInflater()); binding = ActivitySepiaSearchBinding.inflate(getLayoutInflater());
View rootView = binding.getRoot(); View rootView = binding.getRoot();
setContentView(rootView); setContentView(rootView);

View File

@ -6,6 +6,8 @@ import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import app.fedilab.fedilabtube.fragment.SettingsFragment; import app.fedilab.fedilabtube.fragment.SettingsFragment;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
/* Copyright 2020 Thomas Schneider /* Copyright 2020 Thomas Schneider
* *
@ -24,8 +26,10 @@ import app.fedilab.fedilabtube.fragment.SettingsFragment;
public class SettingsActivity extends BaseActivity { public class SettingsActivity extends BaseActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) if (getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -54,6 +54,8 @@ import app.fedilab.fedilabtube.client.data.AccountData;
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment; import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.AccountsVM; import app.fedilab.fedilabtube.viewmodel.AccountsVM;
import app.fedilab.fedilabtube.viewmodel.PostActionsVM; import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
@ -71,8 +73,10 @@ public class ShowAccountActivity extends BaseActivity {
private AccountData.Account account; private AccountData.Account account;
private String accountAcct; private String accountAcct;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_account); setContentView(R.layout.activity_show_account);
setTitle(""); setTitle("");

View File

@ -45,7 +45,6 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -71,6 +70,7 @@ import app.fedilab.fedilabtube.drawer.OwnAccountsAdapter;
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment; import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.sqlite.AccountDAO; import app.fedilab.fedilabtube.sqlite.AccountDAO;
import app.fedilab.fedilabtube.sqlite.Sqlite; import app.fedilab.fedilabtube.sqlite.Sqlite;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM; import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
@ -96,8 +96,10 @@ public class ShowChannelActivity extends BaseActivity {
private boolean sepiaSearch; private boolean sepiaSearch;
private String peertubeInstance; private String peertubeInstance;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_channel); setContentView(R.layout.activity_show_channel);
setTitle(""); setTitle("");

View File

@ -39,6 +39,8 @@ import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.databinding.ActivityVideosTimelineBinding; import app.fedilab.fedilabtube.databinding.ActivityVideosTimelineBinding;
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment; import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.viewmodel.TimelineVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM;
@ -47,10 +49,11 @@ public class VideosTimelineActivity extends BaseActivity {
private TimelineVM.TimelineType type; private TimelineVM.TimelineType type;
private DisplayVideosFragment displayVideosFragment; private DisplayVideosFragment displayVideosFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityVideosTimelineBinding binding = ActivityVideosTimelineBinding.inflate(getLayoutInflater()); ActivityVideosTimelineBinding binding = ActivityVideosTimelineBinding.inflate(getLayoutInflater());
View mainView = binding.getRoot(); View mainView = binding.getRoot();
setContentView(mainView); setContentView(mainView);

View File

@ -29,7 +29,6 @@ import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -37,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import app.fedilab.fedilabtube.R; import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance;
import app.fedilab.fedilabtube.webview.CustomWebview; import app.fedilab.fedilabtube.webview.CustomWebview;
import app.fedilab.fedilabtube.webview.MastalabWebChromeClient; import app.fedilab.fedilabtube.webview.MastalabWebChromeClient;
import app.fedilab.fedilabtube.webview.MastalabWebViewClient; import app.fedilab.fedilabtube.webview.MastalabWebViewClient;
@ -53,9 +53,8 @@ public class WebviewActivity extends BaseActivity {
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview); setContentView(R.layout.activity_webview);
Bundle b = getIntent().getExtras(); Bundle b = getIntent().getExtras();
if (b != null) { if (b != null) {

View File

@ -42,6 +42,8 @@ import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.OauthParams; import app.fedilab.fedilabtube.client.entities.OauthParams;
import app.fedilab.fedilabtube.client.entities.Token; import app.fedilab.fedilabtube.client.entities.Token;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperAcadInstance;
import app.fedilab.fedilabtube.helper.HelperInstance;
public class WebviewConnectActivity extends BaseActivity { public class WebviewConnectActivity extends BaseActivity {
@ -69,8 +71,10 @@ public class WebviewConnectActivity extends BaseActivity {
} }
} }
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
HelperInstance.setTheme(this, HelperInstance.getLiveInstance(this),false);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
WebView.setWebContentsDebuggingEnabled(true); WebView.setWebContentsDebuggingEnabled(true);

View File

@ -60,6 +60,7 @@ import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
import app.fedilab.fedilabtube.client.data.CommentData.Comment; import app.fedilab.fedilabtube.client.data.CommentData.Comment;
import app.fedilab.fedilabtube.client.entities.Report; import app.fedilab.fedilabtube.client.entities.Report;
import app.fedilab.fedilabtube.databinding.DrawerCommentBinding;
import app.fedilab.fedilabtube.helper.CommentDecorationHelper; import app.fedilab.fedilabtube.helper.CommentDecorationHelper;
import app.fedilab.fedilabtube.helper.EmojiHelper; import app.fedilab.fedilabtube.helper.EmojiHelper;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;

View File

@ -56,6 +56,8 @@ import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
import app.fedilab.fedilabtube.client.data.ChannelData; import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.entities.ChannelParams; import app.fedilab.fedilabtube.client.entities.ChannelParams;
import app.fedilab.fedilabtube.databinding.AddChannelBinding;
import app.fedilab.fedilabtube.databinding.FragmentRecyclerviewBinding;
import app.fedilab.fedilabtube.drawer.ChannelListAdapter; import app.fedilab.fedilabtube.drawer.ChannelListAdapter;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.helper.HelperInstance; import app.fedilab.fedilabtube.helper.HelperInstance;

View File

@ -106,7 +106,7 @@ public class Helper {
public static final String REDIRECT_CONTENT_WEB = "tubelab://backtotubelab"; public static final String REDIRECT_CONTENT_WEB = "tubelab://backtotubelab";
public static final int DEFAULT_VIDEO_CACHE_MB = 100; public static final int DEFAULT_VIDEO_CACHE_MB = 100;
@SuppressWarnings({"unused", "RedundantSuppression"}) @SuppressWarnings({"unused", "RedundantSuppression"})
public static final String TAG = "mastodon_etalab"; public static final String TAG = "TubeLab";
public static final String ID = "id"; public static final String ID = "id";
public static final String CLIENT_ID = "client_id"; public static final String CLIENT_ID = "client_id";
public static final String CLIENT_SECRET = "client_secret"; public static final String CLIENT_SECRET = "client_secret";

View File

@ -14,9 +14,23 @@ package app.fedilab.fedilabtube.helper;
* You should have received a copy of the GNU General Public License along with TubeLab; if not, * You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import static app.fedilab.fedilabtube.helper.Helper.TAG;
import android.util.Log;
import androidx.annotation.IdRes;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.view.ContextThemeWrapper;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import app.fedilab.fedilabtube.BuildConfig;
import app.fedilab.fedilabtube.R;
public class HelperAcadInstance { public class HelperAcadInstance {

View File

@ -1,11 +1,18 @@
package app.fedilab.fedilabtube.helper; package app.fedilab.fedilabtube.helper;
import static app.fedilab.fedilabtube.helper.Helper.TAG;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Log;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Locale; import java.util.Locale;
import app.fedilab.fedilabtube.BuildConfig; import app.fedilab.fedilabtube.BuildConfig;
import app.fedilab.fedilabtube.R;
/* Copyright 2020 Thomas Schneider /* Copyright 2020 Thomas Schneider
* *
@ -35,15 +42,47 @@ public class HelperInstance {
if (BuildConfig.FLAVOR.compareTo("fdroid_full") == 0 || BuildConfig.FLAVOR.compareTo("google_full") == 0) { if (BuildConfig.FLAVOR.compareTo("fdroid_full") == 0 || BuildConfig.FLAVOR.compareTo("google_full") == 0) {
return sharedpreferences.getString(Helper.PREF_INSTANCE, getDefaultInstance()); return sharedpreferences.getString(Helper.PREF_INSTANCE, getDefaultInstance());
} else { } else {
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, "tube.ac-lyon.fr"); return sharedpreferences.getString(Helper.PREF_INSTANCE, "tube-institutionnel.apps.education.fr");
if (!instance.startsWith("tube")) {
return "tube.ac-lyon.fr";
} else {
return instance;
}
} }
} }
public static void setTheme(AppCompatActivity activity, String instance, boolean noActionBar) {
switch (instance) {
case "tube-institutionnel.apps.education.fr":
activity.setTheme(noActionBar?R.style.InstitutionnelNoActionBar:R.style.Institutionnel);
break;
case "tube-maternelle.apps.education.fr":
activity.setTheme(noActionBar?R.style.MaternelleNoActionBar:R.style.Maternelle);
break;
case "tube-arts-lettres-sciences-humaines.apps.education.fr":
activity.setTheme(noActionBar?R.style.ArtNoActionBar:R.style.Art);
break;
case "tube-sciences-technologies.apps.education.fr":
activity.setTheme(noActionBar?R.style.SciencesNoActionBar:R.style.Sciences);
break;
case "tube-education-physique-et-sportive.apps.education.fr":
activity.setTheme(noActionBar?R.style.EducationNoActionBar:R.style.Education);
break;
case "tube-enseignement-professionnel.apps.education.fr":
activity.setTheme(noActionBar?R.style.EnseignementProNoActionBar:R.style.EnseignementPro);
break;
case "tube-langues-vivantes.apps.education.fr":
activity.setTheme(noActionBar?R.style.LanguesNoActionBar:R.style.Langues);
break;
case "tube-action-educative.apps.education.fr":
activity.setTheme(noActionBar?R.style.ActionEducativeNoActionBar:R.style.ActionEducative);
break;
case "tube-cycle-2.apps.education.fr":
activity.setTheme(noActionBar?R.style.Cycle2NoActionBar:R.style.Cycle2);
break;
case "tube-cycle-3.apps.education.fr":
activity.setTheme(noActionBar?R.style.Cycle3NoActionBar:R.style.Cycle3);
break;
default:
activity.setTheme(noActionBar?R.style.AppThemeNoActionBar:R.style.AppTheme);
}
}
/** /**
* Get a default instance host name depending of the device locale * Get a default instance host name depending of the device locale