Android Open Source - FirstTipCalc First Tip Application






From Project

Back to project page FirstTipCalc.

License

The source code is released under:

Apache License

If you think the Android project FirstTipCalc 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

/**
 * Copyright 2014 ReliQ Artz/*from  w  w  w  . ja  v  a  2 s. c  o m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.reliqartz.firsttipcalc;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.preference.PreferenceManager;
import android.util.Log;

/**
 * The application class.
 * @author Patrick Reid
 */
public class FirstTipApplication extends Application implements OnSharedPreferenceChangeListener {
  private static final String TAG = "FirstTip";
  private static final String ADS_PREF_KEY = "pref_ads";
  
  public static boolean sShowAds = true;
  
  /* (non-Javadoc)
   * @see android.app.Application#onCreate()
   */
  @Override
  public void onCreate() {
    super.onCreate();
    Log.v(TAG, "Application started.");
    loadPreferences();
  }
  
  /* (non-Javadoc)
   * @see android.content.SharedPreferences.OnSharedPreferenceChangeListener#onSharedPreferenceChanged(android.content.SharedPreferences, java.lang.String)
   */
  @Override
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    loadPreferences();
  }
  
  /**
   * Load application preferences.
   */
  private void loadPreferences() {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    sShowAds = settings.getBoolean(ADS_PREF_KEY, true);
    settings.registerOnSharedPreferenceChangeListener(this);
  }
  
}




Java Source Code List

com.reliqartz.firsttipcalc.FirstTipApplication.java
com.reliqartz.firsttipcalc.gui.AdFragment.java
com.reliqartz.firsttipcalc.gui.CalcFragment.java
com.reliqartz.firsttipcalc.gui.MainActivity.java
com.reliqartz.firsttipcalc.gui.RatioDialog.java
com.reliqartz.firsttipcalc.gui.RatioShareAdapter.java
com.reliqartz.firsttipcalc.gui.SettingsActivity.java
com.reliqartz.firsttipcalc.gui.SplitterFragment.java
com.reliqartz.firsttipcalc.interfaces.FinalBillChangeListener.java
com.reliqartz.firsttipcalc.interfaces.SplitRatioChangeListener.java
com.reliqartz.firsttipcalc.utils.FontApplicator.java
com.reliqartz.firsttipcalc.utils.FontLibrary.java
com.reliqartz.firsttipcalc.utils.ValidTextUtils.java
com.reliqartz.firsttipcalc.utils.ViewTraverser.java