mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 14:08:26 +00:00
clean dynamic theme
This commit is contained in:
parent
93df9641c4
commit
0c191d5177
@ -9,7 +9,6 @@ import android.widget.Toast;
|
||||
|
||||
import org.session.libsignal.utilities.logging.Log;
|
||||
import org.thoughtcrime.securesms.logsubmit.SubmitLogFragment;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
@ -19,11 +18,9 @@ import network.loki.messenger.R;
|
||||
public class LogSubmitActivity extends BaseActionBarActivity implements SubmitLogFragment.OnLogSubmittedListener {
|
||||
|
||||
private static final String TAG = LogSubmitActivity.class.getSimpleName();
|
||||
private DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
dynamicTheme.onCreate(this);
|
||||
super.onCreate(icicle);
|
||||
setContentView(R.layout.log_submit_activity);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
@ -35,7 +32,6 @@ public class LogSubmitActivity extends BaseActionBarActivity implements SubmitLo
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
dynamicTheme.onResume(this);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@ import android.view.MenuItem;
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity;
|
||||
import org.thoughtcrime.securesms.ShareActivity;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
@ -21,8 +20,6 @@ import network.loki.messenger.R;
|
||||
*/
|
||||
public final class StickerManagementActivity extends PassphraseRequiredActionBarActivity implements StickerManagementAdapter.EventListener {
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
|
||||
private RecyclerView list;
|
||||
private StickerManagementAdapter adapter;
|
||||
|
||||
@ -35,7 +32,6 @@ public final class StickerManagementActivity extends PassphraseRequiredActionBar
|
||||
@Override
|
||||
protected void onPreCreate() {
|
||||
super.onPreCreate();
|
||||
dynamicTheme.onCreate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,7 +52,6 @@ public final class StickerManagementActivity extends PassphraseRequiredActionBar
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
dynamicTheme.onResume(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,46 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
/**
|
||||
* @deprecated Use one of the Theme.Session.DayNight.*
|
||||
* (or Theme.TextSecure.DayNight.* for old Signal activities)
|
||||
* app themes to support dark/light modes.
|
||||
*/
|
||||
@Deprecated
|
||||
public class DynamicTheme {
|
||||
|
||||
public static final String DARK = "dark";
|
||||
public static final String LIGHT = "light";
|
||||
|
||||
private int currentTheme;
|
||||
|
||||
public void onCreate(Activity activity) {
|
||||
currentTheme = getSelectedTheme(activity);
|
||||
activity.setTheme(currentTheme);
|
||||
}
|
||||
|
||||
public void onResume(Activity activity) {
|
||||
if (currentTheme != getSelectedTheme(activity)) {
|
||||
Intent intent = activity.getIntent();
|
||||
activity.finish();
|
||||
OverridePendingTransition.invoke(activity);
|
||||
activity.startActivity(intent);
|
||||
OverridePendingTransition.invoke(activity);
|
||||
}
|
||||
}
|
||||
|
||||
protected int getSelectedTheme(Activity activity) {
|
||||
// For all legacy (Signal) activities we lock on to the Signal dedicated theme.
|
||||
return R.style.Theme_TextSecure_DayNight;
|
||||
}
|
||||
|
||||
private static final class OverridePendingTransition {
|
||||
static void invoke(Activity activity) {
|
||||
activity.overridePendingTransition(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user