Search in sources :

Example 11 with Prefs

use of com.a5corp.weather.preferences.Prefs in project Weather by Sparker0i.

the class AppCompatPreferenceActivity method attachBaseContext.

@Override
protected void attachBaseContext(Context newBase) {
    Context context = MyContextWrapper.wrap(newBase, new Prefs(newBase).getLanguage());
    super.attachBaseContext(context);
}
Also used : Context(android.content.Context) Prefs(com.a5corp.weather.preferences.Prefs)

Example 12 with Prefs

use of com.a5corp.weather.preferences.Prefs in project Weather by Sparker0i.

the class AlarmTriggerService method onHandleIntent.

@Override
protected void onHandleIntent(Intent intent) {
    preferences = new Prefs(this);
    if (preferences.getNotifs()) {
        Intent myIntent = new Intent(this, MyReceiver.class);
        pendingIntent = PendingIntent.getBroadcast(this, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
        am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), AlarmManager.INTERVAL_HOUR, pendingIntent);
    }
}
Also used : AlarmManager(android.app.AlarmManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) Prefs(com.a5corp.weather.preferences.Prefs)

Example 13 with Prefs

use of com.a5corp.weather.preferences.Prefs in project Weather by Sparker0i.

the class CustomBottomSheetDialogFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.dialog_modal, container, false);
    condition = rootView.findViewById(R.id.description);
    preferences = new Prefs(getContext());
    nightValue = rootView.findViewById(R.id.night_temperature);
    mornValue = rootView.findViewById(R.id.morning_temperature);
    dayValue = rootView.findViewById(R.id.day_temperature);
    eveValue = rootView.findViewById(R.id.evening_temperature);
    windIcon = rootView.findViewById(R.id.wind_icon);
    windIcon.setTypeface(weatherFont);
    windIcon.setText(getString(R.string.speed_icon));
    rainIcon = rootView.findViewById(R.id.rain_icon);
    rainIcon.setTypeface(weatherFont);
    rainIcon.setText(getString(R.string.rain));
    snowIcon = rootView.findViewById(R.id.snow_icon);
    snowIcon.setTypeface(weatherFont);
    snowIcon.setText(getString(R.string.snow));
    humidityIcon = rootView.findViewById(R.id.humidity_icon);
    humidityIcon.setTypeface(weatherFont);
    humidityIcon.setText(getString(R.string.humidity_icon));
    pressureIcon = rootView.findViewById(R.id.pressure_icon);
    pressureIcon.setTypeface(weatherFont);
    pressureIcon.setText(getString(R.string.pressure_icon));
    windText = rootView.findViewById(R.id.wind);
    rainText = rootView.findViewById(R.id.rain);
    snowText = rootView.findViewById(R.id.snow);
    humidityText = rootView.findViewById(R.id.humidity);
    pressureText = rootView.findViewById(R.id.pressure);
    updateElements();
    return rootView;
}
Also used : Prefs(com.a5corp.weather.preferences.Prefs)

Example 14 with Prefs

use of com.a5corp.weather.preferences.Prefs in project Weather by Sparker0i.

the class GraphsFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mValueFormatter = new CustomFormatter();
    pf = new Prefs(getContext());
    setHasOptionsMenu(true);
}
Also used : CustomFormatter(com.a5corp.weather.utils.CustomFormatter) Prefs(com.a5corp.weather.preferences.Prefs)

Example 15 with Prefs

use of com.a5corp.weather.preferences.Prefs in project Weather by Sparker0i.

the class GraphsFragment method getDay.

public String getDay(long dt) {
    dt *= 1000;
    Calendar c = Calendar.getInstance();
    c.setTime(new Date(dt));
    return c.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, new Locale(new Prefs(getActivity()).getLanguage()));
}
Also used : Locale(java.util.Locale) Calendar(java.util.Calendar) Prefs(com.a5corp.weather.preferences.Prefs) Date(java.util.Date)

Aggregations

Prefs (com.a5corp.weather.preferences.Prefs)25 AlarmManager (android.app.AlarmManager)6 Intent (android.content.Intent)6 PendingIntent (android.app.PendingIntent)5 Context (android.content.Context)5 WeatherInfo (com.a5corp.weather.model.WeatherInfo)3 Date (java.util.Date)3 Bundle (android.os.Bundle)2 View (android.view.View)2 WeatherActivity (com.a5corp.weather.activity.WeatherActivity)2 WeatherFragment (com.a5corp.weather.fragment.WeatherFragment)2 CheckConnection (com.a5corp.weather.internet.CheckConnection)2 Gson (com.google.gson.Gson)2 IOException (java.io.IOException)2 Locale (java.util.Locale)2 SharedPreferences (android.content.SharedPreferences)1 Configuration (android.content.res.Configuration)1 Handler (android.os.Handler)1 KeyEvent (android.view.KeyEvent)1 Button (android.widget.Button)1