-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.2" | ||
|
||
defaultConfig { | ||
applicationId "pk.aspirasoft.tasbih" | ||
minSdkVersion 14 | ||
targetSdkVersion 25 | ||
versionCode 3 | ||
versionName "1.2" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
compile 'com.google.firebase:firebase-ads:10.0.1' | ||
testCompile 'junit:junit:4.12' | ||
} | ||
|
||
|
||
apply plugin: 'com.google.gms.google-services' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "938108936684", | ||
"firebase_url": "https://admob-app-id-5243770836.firebaseio.com", | ||
"project_id": "admob-app-id-5243770836", | ||
"storage_bucket": "admob-app-id-5243770836.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:938108936684:android:733426dcfe97a2f4", | ||
"android_client_info": { | ||
"package_name": "pk.aspirasoft.tasbih" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "938108936684-07updfue0rsfulllv6rnm7fg4l5s29d1.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyBeXJf6eqDw-dRqMSBiZGFe2zg0nm7vd3A" | ||
} | ||
], | ||
"services": { | ||
"analytics_service": { | ||
"status": 1 | ||
}, | ||
"appinvite_service": { | ||
"status": 1, | ||
"other_platform_oauth_client": [] | ||
}, | ||
"ads_service": { | ||
"status": 2 | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in C:\Program Files (x86)\Android\android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="pk.aspirasoft.tasbih"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<meta-data android:name="com.google.android.gms.games.APP_ID" | ||
android:value="@string/app_id" /> | ||
|
||
<activity android:name=".scenes.LaunchScreen" android:screenOrientation="portrait" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".scenes.CounterDrawer" android:screenOrientation="portrait" /> | ||
<activity android:name=".scenes.ActiveCounter" android:screenOrientation="portrait" android:parentActivityName=".scenes.CounterDrawer" /> | ||
<activity android:name=".scenes.CreateCounter" android:screenOrientation="portrait" android:parentActivityName=".scenes.CounterDrawer" /> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package pk.aspirasoft.tasbih.data; | ||
|
||
public class Counter { | ||
|
||
private static final String sep = "\t"; | ||
|
||
private final String name; | ||
private final String description; | ||
private int value; | ||
|
||
public Counter(String rawData) throws IndexOutOfBoundsException { | ||
String[] data = rawData.split(sep); | ||
this.name = data[0]; | ||
this.description = data[1]; | ||
this.value = Integer.parseInt(data[2]); | ||
} | ||
|
||
public Counter(String name, String description) { | ||
this.name = name; | ||
this.description = description; | ||
this.value = 0; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(int value) throws ArithmeticException { | ||
if (value < 0) | ||
throw new ArithmeticException(); | ||
|
||
this.value = value; | ||
} | ||
|
||
public void increment() { | ||
this.value ++; | ||
} | ||
|
||
public void decrement() { | ||
if (this.value > 0) this.value--; | ||
} | ||
|
||
public void reset() { | ||
this.value = 0; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String string = ""; | ||
string += name + sep; | ||
string += description + sep; | ||
string += String.valueOf(value); | ||
return string; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package pk.aspirasoft.tasbih.data; | ||
|
||
import android.app.Activity; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class CounterManager extends ArrayList<Counter> { | ||
|
||
private static CounterManager ourInstance; | ||
private final Database database; | ||
|
||
private CounterManager(Activity activity) { | ||
database = Database.getInstance(activity); | ||
diskIn(); | ||
} | ||
|
||
public static CounterManager getInstance(Activity activity) throws NullPointerException { | ||
if (ourInstance == null) { | ||
ourInstance = new CounterManager(activity); | ||
} | ||
|
||
return ourInstance; | ||
} | ||
|
||
public void diskOut() { | ||
database.put(toString()); | ||
} | ||
|
||
private void diskIn() { | ||
String counters = database.get(); | ||
|
||
if (counters != null) { | ||
fromString(counters); | ||
} | ||
} | ||
|
||
public void fromString(String counters) { | ||
clear(); | ||
|
||
for (String s : counters.split("\n")) { | ||
if (!s.replace("\t", "").replace(" ", "").equals("")) { | ||
Counter counter = new Counter(s); | ||
add(counter); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String string = ""; | ||
for (int i = 0; i < size(); i++) { | ||
string += get(i).toString() + "\n"; | ||
} | ||
string += ""; | ||
return string; | ||
} | ||
|
||
@Override | ||
public boolean add(Counter object) { | ||
for (Counter c : this) { | ||
if (c.getName().equals(object.getName())) | ||
return false; | ||
} | ||
|
||
return super.add(object); | ||
} | ||
} |