This repository has been archived by the owner on May 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #468 from a93-39a/master
Themes and Bug Fixes
- Loading branch information
Showing
68 changed files
with
1,216 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-dontobfuscate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en"> | ||
<string name="hello">Hello World!</string> | ||
<string name="app_name">SLS Tests</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.adam.aslfms; | ||
|
||
import android.content.Intent; | ||
import android.content.res.Resources; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.Log; | ||
import android.view.View; | ||
|
||
import com.adam.aslfms.util.AppSettings; | ||
|
||
public class ChangeThemeActivity extends AppCompatActivity { | ||
private static final String TAG = "ChangeThemeActivity"; | ||
private AppSettings settings; | ||
|
||
@Override | ||
public Resources.Theme getTheme() { | ||
settings = new AppSettings(this); | ||
Resources.Theme theme = super.getTheme(); | ||
theme.applyStyle(settings.getAppTheme(), true); | ||
Log.e(TAG, getResources().getResourceName(settings.getAppTheme())); | ||
// you could also use a switch if you have many themes that could apply | ||
return theme; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.theme_options); | ||
settings = new AppSettings(this); | ||
setTheme(settings.getAppTheme()); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
} | ||
|
||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
} | ||
|
||
public void onRadioButtonClicked(View view){ | ||
switch (view.getId()) { | ||
case R.id.default_theme: | ||
settings.setAppTheme(R.style.AppTheme); | ||
break; | ||
case R.id.default_theme_dark: | ||
settings.setAppTheme(R.style.AppTheme_Dark); | ||
break; | ||
case R.id.lastfm_theme: | ||
settings.setAppTheme(R.style.AppThemeLastFm); | ||
break; | ||
case R.id.lastfm_theme_dark: | ||
settings.setAppTheme(R.style.AppThemeLastFmDark); | ||
break; | ||
case R.id.librefm_theme: | ||
settings.setAppTheme(R.style.AppThemeLibreFm); | ||
break; | ||
case R.id.librefm_theme_dark: | ||
settings.setAppTheme(R.style.AppThemeLibreFmDark); | ||
break; | ||
case R.id.listenbrainz_theme: | ||
settings.setAppTheme(R.style.AppThemeListenBrainz); | ||
break; | ||
case R.id.listenbrainz_theme_dark: | ||
settings.setAppTheme(R.style.AppThemeListenBrainzDark); | ||
break; | ||
default: | ||
settings.setAppTheme(R.style.AppTheme); | ||
} | ||
setTheme(settings.getAppTheme()); | ||
Log.d(TAG, view.getResources().getResourceName(settings.getAppTheme())); | ||
Intent intent = new Intent(this, SettingsActivity.class); | ||
startActivity(intent); | ||
} | ||
} |
Oops, something went wrong.