- git (re)init (git structure was corrupted)
- added shuffler and repeat mode - xxxhdpi icons - typos - new styles - not fully working playing queue [alpha]
This commit is contained in:
commit
32f76f5418
277 changed files with 20259 additions and 0 deletions
84
app/src/main/java/com/kabouzeid/materialmusic/App.java
Normal file
84
app/src/main/java/com/kabouzeid/materialmusic/App.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package com.kabouzeid.materialmusic;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.Fragment;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.kabouzeid.materialmusic.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.materialmusic.misc.AppKeys;
|
||||
import com.kabouzeid.materialmusic.util.ImageLoaderUtil;
|
||||
|
||||
import io.fabric.sdk.android.Fabric;
|
||||
|
||||
/**
|
||||
* Created by karim on 25.11.14.
|
||||
*/
|
||||
public class App extends Application {
|
||||
private static final String TAG = App.class.getSimpleName();
|
||||
|
||||
public Fragment[] MainActivityFragments = new Fragment[5];
|
||||
private MusicPlayerRemote playerRemote;
|
||||
private int appTheme;
|
||||
private SharedPreferences defaultSharedPreferences;
|
||||
private RequestQueue requestQueue;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Fabric.with(this, new Crashlytics());
|
||||
ImageLoaderUtil.initImageLoader(this);
|
||||
}
|
||||
|
||||
public MusicPlayerRemote getMusicPlayerRemote() {
|
||||
if (playerRemote == null) {
|
||||
playerRemote = new MusicPlayerRemote(this);
|
||||
playerRemote.restorePreviousState();
|
||||
}
|
||||
return playerRemote;
|
||||
}
|
||||
|
||||
public SharedPreferences getDefaultSharedPreferences() {
|
||||
if (defaultSharedPreferences == null) {
|
||||
defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
}
|
||||
return defaultSharedPreferences;
|
||||
}
|
||||
|
||||
public int getAppTheme() {
|
||||
if (appTheme == 0) {
|
||||
appTheme = getDefaultSharedPreferences().getInt(AppKeys.SP_THEME, R.style.Theme_MaterialMusic);
|
||||
}
|
||||
return appTheme;
|
||||
}
|
||||
|
||||
public void setAppTheme(int appTheme) {
|
||||
this.appTheme = appTheme;
|
||||
defaultSharedPreferences.edit().putInt(AppKeys.SP_THEME, appTheme);
|
||||
}
|
||||
|
||||
public boolean isTablet() {
|
||||
return getResources().getConfiguration().smallestScreenWidthDp >= 600;
|
||||
}
|
||||
|
||||
public boolean isInPortraitMode() {
|
||||
return getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
|
||||
}
|
||||
|
||||
public RequestQueue getRequestQueue() {
|
||||
if (requestQueue == null) {
|
||||
requestQueue = Volley.newRequestQueue(this);
|
||||
}
|
||||
return requestQueue;
|
||||
}
|
||||
|
||||
public void addToRequestQueue(Request request) {
|
||||
request.setTag(TAG);
|
||||
getRequestQueue().add(request);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue