Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Saifullah Khan committed Oct 24, 2017
0 parents commit 441e0ce
Show file tree
Hide file tree
Showing 74 changed files with 5,066 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
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
22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/markdown-navigator/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Binary file added app/app-release.apk
Binary file not shown.
30 changes: 30 additions & 0 deletions app/build.gradle
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'
42 changes: 42 additions & 0 deletions app/google-services.json
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"
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
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 *;
#}
30 changes: 30 additions & 0 deletions app/src/main/AndroidManifest.xml
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>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions app/src/main/java/pk/aspirasoft/tasbih/data/Counter.java
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;
}
}
67 changes: 67 additions & 0 deletions app/src/main/java/pk/aspirasoft/tasbih/data/CounterManager.java
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);
}
}
Loading

0 comments on commit 441e0ce

Please sign in to comment.