Android Open Source - PhoneProfiles_Eclipse G U I Data






From Project

Back to project page PhoneProfiles_Eclipse.

License

The source code is released under:

Apache License

If you think the Android project PhoneProfiles_Eclipse 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 sk.henrichg.phoneprofiles;
/*from ww w  .  j av  a 2s .  co m*/
import java.text.Collator;
import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;

public class GUIData {

  public static BrightnessView brightneesView = null;
  
  public static Collator collator = null;
  
  // import/export
  public static final String DB_FILEPATH = "/data/" + GlobalData.PACKAGE_NAME + "/databases";
  public static final String REMOTE_EXPORT_PATH = "/PhoneProfilesPlus";
  public static final String EXPORT_APP_PREF_FILENAME = "ApplicationPreferences.backup";
  public static final String EXPORT_DEF_PROFILE_PREF_FILENAME = "DefaultProfilePreferences.backup";
  

  public static void setLanguage(Context context)//, boolean restart)
  {
    //long nanoTimeStart = GlobalData.startMeasuringRunTime();
    
    // jazyk na aky zmenit
    String lang = GlobalData.applicationLanguage;
    
    //Log.d("EditorProfilesActivity.setLanguauge", lang);

    Locale appLocale;
    
    if (!lang.equals("system"))
    {
        String[] langSplit = lang.split("-");
      if (langSplit.length == 1)
        appLocale = new Locale(lang);
      else
        appLocale = new Locale(langSplit[0], langSplit[1]);
    }
    else
    {
      appLocale = Resources.getSystem().getConfiguration().locale;
    }
    
    Locale.setDefault(appLocale);
    Configuration appConfig = new Configuration();
    appConfig.locale = appLocale;
    context.getResources().updateConfiguration(appConfig, context.getResources().getDisplayMetrics());
    
    // collator for application locale sorting
    collator = getCollator();
    
    //languageChanged = restart;
    
    //GlobalData.getMeasuredRunTime(nanoTimeStart, "GUIData.setLanguage");
    
  }
  
  public static Collator getCollator()
  {
    // get application Locale
    String lang = GlobalData.applicationLanguage;
    Locale appLocale;
    if (!lang.equals("system"))
    {
        String[] langSplit = lang.split("-");
      if (langSplit.length == 1)
        appLocale = new Locale(lang);
      else
        appLocale = new Locale(langSplit[0], langSplit[1]);
    }
    else
    {
      appLocale = Resources.getSystem().getConfiguration().locale;
    }

    // get collator for application locale
    return Collator.getInstance(appLocale);
  }
  
  public static void setTheme(Activity activity, boolean forPopup)
  {
    //long nanoTimeStart = GlobalData.startMeasuringRunTime();
    
    if (GlobalData.applicationTheme.equals("material"))
    {
      //Log.d("EditorProfilesActivity.setTheme","material");
      if (forPopup)
        activity.setTheme(R.style.PopupTheme_material);
      else
        activity.setTheme(R.style.Theme_Phoneprofilestheme_material);
    }
    else
    if (GlobalData.applicationTheme.equals("dark"))
    {
      //Log.d("EditorProfilesActivity.setTheme","dark");
      if (forPopup)
        activity.setTheme(R.style.PopupTheme_dark);
      else
        activity.setTheme(R.style.Theme_Phoneprofilestheme_dark);
    }
    else
    if (GlobalData.applicationTheme.equals("dlight"))
    {
      //Log.d("EditorProfilesActivity.setTheme","dark");
      if (forPopup)
        activity.setTheme(R.style.PopupTheme_dlight);
      else
        activity.setTheme(R.style.Theme_Phoneprofilestheme_dlight);
    }
    
    //GlobalData.getMeasuredRunTime(nanoTimeStart, "GUIData.setTheme");
    
  }
  
  public static void reloadActivity(Activity activity, boolean newIntent)
  {
    if (newIntent)
    {
        Intent intent = activity.getIntent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        activity.finish();
        activity.startActivity(intent);
        activity.overridePendingTransition(0, 0);
    }
    else
      activity.recreate();
  }
  
}




Java Source Code List

sk.henrichg.phoneprofiles.ActivateProfileActivity.java
sk.henrichg.phoneprofiles.ActivateProfileHelper.java
sk.henrichg.phoneprofiles.ActivateProfileListAdapter.java
sk.henrichg.phoneprofiles.ActivateProfileListFragment.java
sk.henrichg.phoneprofiles.ApplicationsCache.java
sk.henrichg.phoneprofiles.ApplicationsPreferenceAdapter.java
sk.henrichg.phoneprofiles.ApplicationsPreferenceDialog.java
sk.henrichg.phoneprofiles.ApplicationsPreference.java
sk.henrichg.phoneprofiles.BackgroundActivateProfileActivity.java
sk.henrichg.phoneprofiles.BitmapManipulator.java
sk.henrichg.phoneprofiles.BootUpReceiver.java
sk.henrichg.phoneprofiles.BrightnessDialogPreference.java
sk.henrichg.phoneprofiles.BrightnessView.java
sk.henrichg.phoneprofiles.DashClockBroadcastReceiver.java
sk.henrichg.phoneprofiles.DataWrapper.java
sk.henrichg.phoneprofiles.DatabaseHandler.java
sk.henrichg.phoneprofiles.EditorProfileListAdapter.java
sk.henrichg.phoneprofiles.EditorProfileListFragment.java
sk.henrichg.phoneprofiles.EditorProfilesActivity.java
sk.henrichg.phoneprofiles.ExecuteRadioProfilePrefsService.java
sk.henrichg.phoneprofiles.ExecuteVolumeProfilePrefsService.java
sk.henrichg.phoneprofiles.FirstStartService.java
sk.henrichg.phoneprofiles.GUIData.java
sk.henrichg.phoneprofiles.GlobalData.java
sk.henrichg.phoneprofiles.IconWidgetProvider.java
sk.henrichg.phoneprofiles.ImageViewPreferenceAdapter.java
sk.henrichg.phoneprofiles.ImageViewPreferenceDialog.java
sk.henrichg.phoneprofiles.ImageViewPreference.java
sk.henrichg.phoneprofiles.KeyguardService.java
sk.henrichg.phoneprofiles.Keyguard.java
sk.henrichg.phoneprofiles.LocaleChangedReceiver.java
sk.henrichg.phoneprofiles.NumberPickerPreference.java
sk.henrichg.phoneprofiles.OneRowWidgetProvider.java
sk.henrichg.phoneprofiles.PackageReplacedReceiver.java
sk.henrichg.phoneprofiles.PhoneCallBroadcastReceiver.java
sk.henrichg.phoneprofiles.PhoneCallReceiver.java
sk.henrichg.phoneprofiles.PhoneProfilesDashClockExtension.java
sk.henrichg.phoneprofiles.PhoneProfilesHelper.java
sk.henrichg.phoneprofiles.PhoneProfilesPreferencesActivity.java
sk.henrichg.phoneprofiles.PhoneProfilesPreferencesFragment.java
sk.henrichg.phoneprofiles.ProfileDurationAlarmBroadcastReceiver.java
sk.henrichg.phoneprofiles.ProfileListWidgetFactory.java
sk.henrichg.phoneprofiles.ProfileListWidgetProvider.java
sk.henrichg.phoneprofiles.ProfileListWidgetService.java
sk.henrichg.phoneprofiles.ProfilePreferenceAdapter.java
sk.henrichg.phoneprofiles.ProfilePreferenceDialog.java
sk.henrichg.phoneprofiles.ProfilePreference.java
sk.henrichg.phoneprofiles.ProfilePreferencesFragmentActivity.java
sk.henrichg.phoneprofiles.ProfilePreferencesFragment.java
sk.henrichg.phoneprofiles.ProfilePreferencesIndicator.java
sk.henrichg.phoneprofiles.Profile.java
sk.henrichg.phoneprofiles.ReceiversService.java
sk.henrichg.phoneprofiles.RefreshGUIBroadcastReceiver.java
sk.henrichg.phoneprofiles.RemoteExportDataActivity.java
sk.henrichg.phoneprofiles.RemoveBrightnessViewBroadcastReceiver.java
sk.henrichg.phoneprofiles.ScreenOnOffBroadcastReceiver.java
sk.henrichg.phoneprofiles.ShortcutCreatorActivity.java
sk.henrichg.phoneprofiles.ShortcutCreatorListFragment.java
sk.henrichg.phoneprofiles.ShortcutProfileListAdapter.java
sk.henrichg.phoneprofiles.UpgradePPHelperActivity.java
sk.henrichg.phoneprofiles.VolumeDialogPreference.java