Search in sources :

Example 16 with Prefs

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

the class FirstLaunch 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 17 with Prefs

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

the class WeatherActivity 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 18 with Prefs

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

the class WeatherActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_weather);
    Log.i("Activity", WeatherActivity.class.getSimpleName());
    mManager = NotificationManagerCompat.from(this);
    preferences = new Prefs(this);
    toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            hideFab();
            showInputDialog();
        }
    });
    Intent intent = getIntent();
    handler = new Handler();
    fab.show();
    wf = new WeatherFragment();
    Bundle bundle = new Bundle();
    bundle.putInt("mode", intent.getIntExtra(Constants.MODE, 0));
    wf.setArguments(bundle);
    gf = new GraphsFragment();
    // mf = new MapsFragment();
    dbHelper = new DBHelper(this);
    getSupportFragmentManager().beginTransaction().replace(R.id.fragment, wf).commit();
    initDrawer();
    NotificationService.enqueueWork(this, new Intent(this, WeatherActivity.class));
}
Also used : Bundle(android.os.Bundle) DBHelper(com.a5corp.weather.preferences.DBHelper) Handler(android.os.Handler) Intent(android.content.Intent) WeatherFragment(com.a5corp.weather.fragment.WeatherFragment) Prefs(com.a5corp.weather.preferences.Prefs) View(android.view.View) GraphsFragment(com.a5corp.weather.fragment.GraphsFragment)

Example 19 with Prefs

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

the class SettingsActivity 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 20 with Prefs

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

the class GlobalActivity method onResume.

@Override
protected void onResume() {
    cp = new Preferences(this);
    prefs = new Prefs(this);
    super.onResume();
    if (!cp.getPrefs().getBoolean("first", true)) {
        prefs.setLaunched();
        prefs.setCity(cp.getCity());
    }
    super.onResume();
    Intent intent;
    if (prefs.getLaunched()) {
        intent = new Intent(GlobalActivity.this, WeatherActivity.class);
    } else {
        intent = new Intent(GlobalActivity.this, FirstLaunch.class);
    }
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    startActivity(intent);
}
Also used : Intent(android.content.Intent) FirstLaunch(com.a5corp.weather.activity.FirstLaunch) WeatherActivity(com.a5corp.weather.activity.WeatherActivity) Preferences(com.a5corp.weather.preferences.Preferences) Prefs(com.a5corp.weather.preferences.Prefs)

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