Android Open Source - NokiaXTheme Helpers






From Project

Back to project page NokiaXTheme.

License

The source code is released under:

Apache License

If you think the Android project NokiaXTheme listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.nokiaxtheme;
/*  w ww.  j a  v  a2s .co m*/
import java.util.Locale;

import android.content.Context;
import android.os.Build;

public class Helpers {
  
  /**
   * Sets the correct theme based on the device that the app is running on.
   * You have two options for implementing this:
   *  - set the theme on the Application object
   *  - call this method at the beginning of onCreate in every Activity
   * 
   * @param c  context, e.g. an Application or Activity
   */
  public static void setTheme(Context c) {
    if (!Build.MANUFACTURER.toLowerCase(Locale.US).contains("nokia")) {
      c.setTheme(R.style.AppTheme);
      //c.setTheme(R.style.AppTheme_Light);
      //c.setTheme(R.style.AppTheme_Light_DarkActionBar);
    } else {
      c.setTheme(R.style.AppTheme_Nokia);
      //c.setTheme(R.style.AppTheme_Nokia_Light);
      //c.setTheme(R.style.AppTheme_Nokia_Light_DarkActionBar);
    }
  }
  
}




Java Source Code List

com.example.nokiaxtheme.Helpers.java
com.example.nokiaxtheme.MainActivity.java