Skip to content

Commit

Permalink
Added toolbar and statusbar to theming
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Feb 23, 2019
1 parent 5c7e616 commit a499c56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.support.iosched.tabs.VanillaTabLayout;
import android.view.View;
import android.widget.CheckBox;
import android.widget.SeekBar;

import java.util.ArrayList;

import androidx.core.graphics.ColorUtils;
import androidx.fragment.app.Fragment;

public class ThemeHelper {
Expand All @@ -54,6 +56,11 @@ final public static void setAccentColor(Activity a) {
String c = "#b13fb5";

int myColor = Color.parseColor(c);
int myColorDark = ColorUtils.blendARGB(Color.parseColor(c), Color.BLACK, 0.15f);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
a.getWindow().setStatusBarColor(myColorDark);
}

ActionBar actionBar = a.getActionBar();
if(actionBar!=null){
Expand All @@ -74,6 +81,11 @@ final public static void setAccentColor(Activity a) {
mBottomBarControls.setBackgroundColor(myColor);
}

VanillaTabLayout mVanillaTabLayout = (VanillaTabLayout) a.findViewById(R.id.sliding_tabs);
if(mVanillaTabLayout != null){
mVanillaTabLayout.setBackgroundColor(myColor);
}


ArrayList<CheckBox> checkboxes = new ArrayList<CheckBox>();
ArrayList<View> availableViews = a.getWindow().getDecorView().getFocusables(View.FOCUS_FORWARD);
Expand All @@ -82,7 +94,6 @@ final public static void setAccentColor(Activity a) {
if(actualView instanceof CheckBox) {
checkboxes.add((CheckBox) actualView);
}

}
for(CheckBox mCheckbox: checkboxes){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/library_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ THE SOFTWARE.
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<android.support.iosched.tabs.VanillaTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="?tabs_background" />
android:background="?tabs_background"
android:elevation="4dp" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
Expand Down

0 comments on commit a499c56

Please sign in to comment.