-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6d2acc
commit 4c0d51c
Showing
22 changed files
with
977 additions
and
880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 88 additions & 75 deletions
163
AppSpecificOrientation/src/main/java/com/spydiko/rotationmanager/AppSpecificOrientation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,101 @@ | ||
package com.spydiko.rotationmanager; | ||
|
||
import android.app.Activity; | ||
import android.app.Application; | ||
import android.content.SharedPreferences; | ||
import android.content.pm.PackageManager; | ||
import android.preference.PreferenceManager; | ||
import android.util.Log; | ||
|
||
import com.startapp.android.publish.StartAppAd; | ||
import com.jirbo.adcolony.AdColony; | ||
|
||
/** | ||
* Created by PuR3v1L on 7/8/2013. | ||
*/ | ||
public class AppSpecificOrientation extends Application { | ||
|
||
private static SharedPreferences prefs; | ||
private static SharedPreferences.Editor editor; | ||
private static boolean check_button; | ||
|
||
|
||
public static boolean isServiceRunning() { | ||
return prefs.getBoolean("service", false); | ||
} | ||
|
||
public static void setServiceRunning(boolean serviceRunning) { | ||
editor.putBoolean("service", serviceRunning); | ||
editor.commit(); | ||
} | ||
|
||
public static boolean getBoot() { | ||
return prefs.getBoolean("boot", false); | ||
} | ||
|
||
public static void setBoot(boolean state) { | ||
editor.putBoolean("boot", state); | ||
editor.commit(); | ||
} | ||
|
||
public static boolean isCheck_button() { | ||
return check_button; | ||
} | ||
|
||
public static void setCheck_button(boolean check_button) { | ||
AppSpecificOrientation.check_button = check_button; | ||
} | ||
|
||
public boolean loadDonate (String type) { | ||
return prefs.getBoolean(type,false); | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
prefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
editor = prefs.edit(); | ||
} | ||
|
||
public boolean loadPreferences(String app, Boolean type) { | ||
if (type) { | ||
return prefs.getBoolean(app.concat("portrait"), false); | ||
} else { | ||
return prefs.getBoolean(app.concat("landscape"), false); | ||
} | ||
} | ||
|
||
public void savePreferences(String app, Boolean check, Boolean type) { | ||
if (type) { | ||
editor.putBoolean(app.concat("portrait"), check); | ||
} else { | ||
editor.putBoolean(app.concat("landscape"), check); | ||
} | ||
editor.commit(); | ||
} | ||
|
||
public boolean isCheckedLandscape(String temp) { | ||
return prefs.getBoolean(temp.concat("landscape"), false); | ||
} | ||
|
||
public boolean isCheckedPortrait(String temp) { | ||
return prefs.getBoolean(temp.concat("portrait"), false); | ||
} | ||
|
||
public void registerShared(DonateActivity donateActivity) { | ||
prefs.registerOnSharedPreferenceChangeListener(donateActivity); | ||
} | ||
|
||
public void unregisterShared(DonateActivity donateActivity) { | ||
prefs.unregisterOnSharedPreferenceChangeListener(donateActivity); | ||
} | ||
public static final boolean LOG = true; | ||
private static final String TAG = AppSpecificOrientation.class.getSimpleName(); | ||
private static SharedPreferences prefs; | ||
private static SharedPreferences.Editor editor; | ||
private static boolean check_button; | ||
|
||
|
||
public static boolean isServiceRunning() { | ||
return prefs.getBoolean("service", false); | ||
} | ||
|
||
public static void setServiceRunning(boolean serviceRunning) { | ||
editor.putBoolean("service", serviceRunning); | ||
editor.commit(); | ||
} | ||
|
||
public static boolean getBoot() { | ||
return prefs.getBoolean("boot", false); | ||
} | ||
|
||
public static void setBoot(boolean state) { | ||
editor.putBoolean("boot", state); | ||
editor.commit(); | ||
} | ||
|
||
public static boolean isCheck_button() { | ||
return check_button; | ||
} | ||
|
||
public static void setCheck_button(boolean check_button) { | ||
AppSpecificOrientation.check_button = check_button; | ||
} | ||
|
||
public boolean loadDonate(String type) { | ||
return prefs.getBoolean(type, false); | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
prefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
editor = prefs.edit(); | ||
} | ||
|
||
public boolean loadPreferences(String app, Boolean type) { | ||
if (type) { | ||
return prefs.getBoolean(app.concat("portrait"), false); | ||
} else { | ||
return prefs.getBoolean(app.concat("landscape"), false); | ||
} | ||
} | ||
|
||
public void savePreferences(String app, Boolean check, Boolean type) { | ||
if (type) { | ||
editor.putBoolean(app.concat("portrait"), check); | ||
} else { | ||
editor.putBoolean(app.concat("landscape"), check); | ||
} | ||
editor.commit(); | ||
} | ||
|
||
public boolean isCheckedLandscape(String temp) { | ||
return prefs.getBoolean(temp.concat("landscape"), false); | ||
} | ||
|
||
public boolean isCheckedPortrait(String temp) { | ||
return prefs.getBoolean(temp.concat("portrait"), false); | ||
} | ||
|
||
public void configureAdColony(Activity act) { | ||
try { | ||
if (AppSpecificOrientation.LOG) Log.d(TAG, "version Code: " + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode); | ||
AdColony.configure(act, "version=" + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + ",store:google", "appc0bebfc9f4a3489fb82153", "vz9bf8a5eb30ef477798b82b"/*, "vz81c21390fa4e4b25aaa8ed", "vzf738e644f1394a9abcf4cf", "vz6494ace59eb4446db403f4"*/); | ||
} catch (PackageManager.NameNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
// public void registerShared(DonateActivity donateActivity) { | ||
// prefs.registerOnSharedPreferenceChangeListener(donateActivity); | ||
// } | ||
// | ||
// public void unregisterShared(DonateActivity donateActivity) { | ||
// prefs.unregisterOnSharedPreferenceChangeListener(donateActivity); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.