-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
202 changed files
with
6,937 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'io.fabric' | ||
|
||
repositories { | ||
maven { url 'https://maven.fabric.io/public' } | ||
} | ||
|
||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.khammami.imerolium" | ||
minSdkVersion 16 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
vectorDrawables.useSupportLibrary = true | ||
|
||
multiDexEnabled true | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
api project(':colorpicker') | ||
implementation 'com.android.support:multidex:1.0.3' | ||
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' | ||
implementation 'com.android.support:preference-v7:28.0.0-alpha3' | ||
implementation 'com.android.support:design:28.0.0-alpha3' | ||
implementation 'com.android.support:support-v4:28.0.0-alpha3' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.2' | ||
|
||
implementation 'com.google.android.gms:play-services-auth:15.0.1' | ||
implementation 'com.google.firebase:firebase-core:16.0.1' | ||
implementation 'com.google.firebase:firebase-auth:16.0.2' | ||
implementation 'com.google.firebase:firebase-firestore:17.0.2' | ||
|
||
implementation "android.arch.lifecycle:runtime:1.1.1" | ||
implementation "android.arch.lifecycle:extensions:1.1.1" | ||
annotationProcessor "android.arch.lifecycle:compiler:1.1.1" | ||
implementation "android.arch.persistence.room:runtime:1.1.1" | ||
annotationProcessor "android.arch.persistence.room:compiler:1.1.1" | ||
|
||
api('com.google.api-client:google-api-client-android:1.23.0') { | ||
exclude group: 'com.google.code.findbugs' | ||
exclude group: 'org.apache.httpcomponents' | ||
exclude group: 'com.google.guava' | ||
} | ||
api('com.google.apis:google-api-services-people:v1-rev168-1.23.0') { | ||
exclude group: 'com.google.code.findbugs' | ||
exclude group: 'org.apache.httpcomponents' | ||
exclude group: 'com.google.guava' | ||
} | ||
|
||
implementation 'com.squareup.picasso:picasso:2.71828' | ||
|
||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') { | ||
transitive = true | ||
} | ||
} | ||
|
||
apply plugin: 'com.google.gms.google-services' |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# 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 *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/khammami/imerolium/ExampleInstrumentedTest.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.khammami.imerolium; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.khammami.imerolium", appContext.getPackageName()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.khammami.imerolium"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:name=".BasicApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".ui.MainActivity" | ||
android:label="@string/app_name" | ||
android:launchMode="singleTop" | ||
android:theme="@style/AppTheme.Launcher"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<meta-data | ||
android:name="io.fabric.ApiKey" | ||
android:value="YOUR_FABRIC_API_KEY" /> | ||
|
||
<activity | ||
android:name=".ui.LoginActivity" | ||
android:theme="@style/AppTheme.OnlyStatusBar" /> | ||
<activity | ||
android:name=".ui.PostActivity" | ||
android:label="" /> | ||
<activity android:name=".ui.settings.SettingsActivity" | ||
android:label="@string/settings_activity_label"/> | ||
|
||
</application> | ||
|
||
</manifest> |
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/khammami/imerolium/AppExecutors.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.khammami.imerolium; | ||
|
||
import android.os.Handler; | ||
import android.os.Looper; | ||
import android.support.annotation.NonNull; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.Executors; | ||
|
||
public class AppExecutors { | ||
|
||
// For Singleton instantiation | ||
private static final Object LOCK = new Object(); | ||
private static AppExecutors sInstance; | ||
private final Executor diskIO; | ||
private final Executor mainThread; | ||
private final Executor networkIO; | ||
|
||
private AppExecutors(Executor diskIO, Executor networkIO, Executor mainThread) { | ||
this.diskIO = diskIO; | ||
this.networkIO = networkIO; | ||
this.mainThread = mainThread; | ||
} | ||
|
||
public static AppExecutors getInstance() { | ||
if (sInstance == null) { | ||
synchronized (LOCK) { | ||
sInstance = new AppExecutors(Executors.newSingleThreadExecutor(), | ||
Executors.newFixedThreadPool(3), | ||
new MainThreadExecutor()); | ||
} | ||
} | ||
return sInstance; | ||
} | ||
|
||
public Executor diskIO() { | ||
return diskIO; | ||
} | ||
|
||
public Executor mainThread() { | ||
return mainThread; | ||
} | ||
|
||
public Executor networkIO() { | ||
return networkIO; | ||
} | ||
|
||
private static class MainThreadExecutor implements Executor { | ||
private Handler mainThreadHandler = new Handler(Looper.getMainLooper()); | ||
|
||
@Override | ||
public void execute(@NonNull Runnable command) { | ||
mainThreadHandler.post(command); | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/khammami/imerolium/BaseActivity.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.khammami.imerolium; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.annotation.VisibleForTesting; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.FirebaseUser; | ||
import com.khammami.imerolium.ui.LoginActivity; | ||
import com.khammami.imerolium.ui.MainActivity; | ||
|
||
public class BaseActivity extends AppCompatActivity { | ||
|
||
@VisibleForTesting | ||
public FirebaseAuth mAuth; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
mAuth = FirebaseAuth.getInstance(); | ||
checkAuth(); | ||
} | ||
|
||
public void checkAuth() { | ||
FirebaseUser currentUser = mAuth.getCurrentUser(); | ||
if (!(this instanceof LoginActivity) && currentUser == null) { | ||
Intent signInIntent = new Intent(this, LoginActivity.class); | ||
startActivity(signInIntent); | ||
finish(); | ||
}else if((this instanceof LoginActivity) && currentUser != null){ | ||
Intent mainIntent = new Intent(this, MainActivity.class); | ||
startActivity(mainIntent); | ||
finish(); | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/khammami/imerolium/BasicApplication.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.khammami.imerolium; | ||
|
||
import android.app.Application; | ||
import android.support.multidex.MultiDexApplication; | ||
|
||
import com.crashlytics.android.Crashlytics; | ||
import com.google.firebase.firestore.FirebaseFirestore; | ||
import com.google.firebase.firestore.FirebaseFirestoreSettings; | ||
import com.khammami.imerolium.data.AppRepository; | ||
import com.khammami.imerolium.data.db.AppDatabase; | ||
import com.khammami.imerolium.data.net.AppNetworkDataSource; | ||
|
||
import io.fabric.sdk.android.Fabric; | ||
|
||
public class BasicApplication extends MultiDexApplication { | ||
private AppExecutors mAppExecutors; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
//init fabric | ||
final Fabric fabric = new Fabric.Builder(this) | ||
.kits(new Crashlytics()) | ||
.debuggable(true) | ||
.build(); | ||
Fabric.with(fabric); | ||
|
||
mAppExecutors = AppExecutors.getInstance(); | ||
} | ||
|
||
public AppDatabase getDatabase() { | ||
return AppDatabase.getInstance(this); | ||
} | ||
|
||
public AppNetworkDataSource getNetworkResouce() { | ||
return AppNetworkDataSource.getInstance(this, mAppExecutors); | ||
} | ||
|
||
public AppRepository getRepository() { | ||
return AppRepository.getInstance(getDatabase(), getNetworkResouce(), mAppExecutors); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/khammami/imerolium/data/AppPreferences.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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.khammami.imerolium.data; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceManager; | ||
import android.util.Log; | ||
|
||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.FirebaseUser; | ||
import com.khammami.imerolium.R; | ||
|
||
public class AppPreferences { | ||
private static final String TAG = AppPreferences.class.getSimpleName(); | ||
|
||
public static final String AGENDA_VIEW = "agenda"; | ||
public static final String QUILT_VIEW = "quilt"; | ||
|
||
public static void setPostListViewType(Context context, String viewType) { | ||
SharedPreferences sp = getUserSharePreferences(context); | ||
SharedPreferences.Editor editor = sp.edit(); | ||
|
||
editor.putString(context.getString(R.string.pref_post_list_view_type_key), viewType); | ||
editor.apply(); | ||
} | ||
|
||
public static String getPostListViewType(Context context) { | ||
SharedPreferences sp = getUserSharePreferences(context); | ||
return sp.getString(context.getString(R.string.pref_post_list_view_type_key), | ||
QUILT_VIEW); | ||
} | ||
|
||
private static SharedPreferences getUserSharePreferences(Context context){ | ||
String userId = FirebaseAuth.getInstance().getUid(); | ||
return context.getSharedPreferences(userId, Context.MODE_PRIVATE); | ||
|
||
} | ||
|
||
public static void setUserPhotoCover(Context context, String photoUrl) { | ||
SharedPreferences sp = getUserSharePreferences(context); | ||
SharedPreferences.Editor editor = sp.edit(); | ||
|
||
editor.putString(context.getString(R.string.pref_user_cover_key), photoUrl); | ||
editor.apply(); | ||
} | ||
|
||
public static String getUserPhotoCover(Context context) { | ||
SharedPreferences sp = getUserSharePreferences(context); | ||
return sp.getString(context.getString(R.string.pref_user_cover_key), ""); | ||
} | ||
|
||
public static boolean isTimeFormat24(Context context) { | ||
SharedPreferences sp = getUserSharePreferences(context); | ||
return sp.getBoolean(context.getString(R.string.pref_time_format_24h_key), false); | ||
} | ||
} |
Oops, something went wrong.