-
Notifications
You must be signed in to change notification settings - Fork 0
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
18 changed files
with
825 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "760449034411", | ||
"firebase_url": "https://social-blind.firebaseio.com", | ||
"project_id": "social-blind", | ||
"storage_bucket": "social-blind.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:760449034411:android:d8e38be247b30f7952efee", | ||
"android_client_info": { | ||
"package_name": "com.team7.socialblind" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "760449034411-k1qi7gvg9iei9btca3lcfbfqieo31agn.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.team7.socialblind", | ||
"certificate_hash": "10ad5f06619d2bae65a29d6bb2bf9bcd6d042e25" | ||
} | ||
}, | ||
{ | ||
"client_id": "760449034411-l7j0ocnjreikfbfjahlftsdfuc05rpv6.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyCUZgtm0JXKyaCUvdmXCXAG9u8515H7TdM" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [ | ||
{ | ||
"client_id": "760449034411-l7j0ocnjreikfbfjahlftsdfuc05rpv6.apps.googleusercontent.com", | ||
"client_type": 3 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/team7/socialblind/ElbessApplication.kt
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,32 @@ | ||
package com.team7.socialblind | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import android.content.res.Configuration | ||
|
||
import timber.log.Timber | ||
|
||
import com.team7.socialblind.util.LocaleManager | ||
|
||
|
||
class ElbessApplication : Application() { | ||
|
||
|
||
|
||
override fun attachBaseContext(base: Context) { | ||
super.attachBaseContext(LocaleManager.setLocale(base)) | ||
} | ||
|
||
override fun onConfigurationChanged(newConfig: Configuration?) { | ||
super.onConfigurationChanged(newConfig) | ||
LocaleManager.setLocale(this) | ||
} | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
if (BuildConfig.DEBUG) { | ||
Timber.plant(Timber.DebugTree()) | ||
} | ||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/team7/socialblind/base/BaseActivity.kt
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,72 @@ | ||
package com.team7.socialblind.base | ||
|
||
import android.content.Context | ||
import android.content.res.Configuration | ||
import com.google.android.material.snackbar.Snackbar | ||
import android.view.inputmethod.InputMethodManager | ||
import android.widget.Toast | ||
import androidx.annotation.StringRes | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.team7.socialblind.R | ||
import com.team7.socialblind.util.LocaleManager | ||
|
||
|
||
abstract class BaseActivity : AppCompatActivity() { | ||
|
||
override fun attachBaseContext(newBase: Context) { | ||
super.attachBaseContext(LocaleManager.setLocale(newBase)) | ||
} | ||
|
||
override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) { | ||
if (overrideConfiguration != null) { | ||
val uiMode = overrideConfiguration.uiMode | ||
overrideConfiguration.setTo(baseContext.resources.configuration) | ||
overrideConfiguration.uiMode = uiMode | ||
} | ||
super.applyOverrideConfiguration(overrideConfiguration) | ||
} | ||
|
||
fun showSnackBar(message: String) { | ||
val snackbar = Snackbar.make( | ||
findViewById(android.R.id.content), | ||
message, Snackbar.LENGTH_SHORT | ||
) | ||
snackbar.show() | ||
} | ||
|
||
fun hideKeyboard() { | ||
val view = this.currentFocus | ||
if (view != null) { | ||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
imm.hideSoftInputFromWindow(view.windowToken, 0) | ||
} | ||
} | ||
|
||
fun showToast(message: String) { | ||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
fun onError(message: String?) { | ||
if (message != null) { | ||
showSnackBar(message) | ||
} else { | ||
showSnackBar(getString(R.string.uknown_error)) | ||
} | ||
} | ||
|
||
fun onError(@StringRes resId: Int) { | ||
onError(getString(resId)) | ||
} | ||
|
||
fun showMessage(message: String?) { | ||
if (message != null) { | ||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show() | ||
} else { | ||
Toast.makeText(this, getString(R.string.uknown_error), Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
|
||
fun showMessage(@StringRes resId: Int) { | ||
showMessage(getString(resId)) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/team7/socialblind/base/BaseDataSource.kt
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 @@ | ||
package com.team7.elbess.base | ||
|
||
import androidx.paging.PositionalDataSource | ||
import timber.log.Timber | ||
|
||
abstract class BaseDataSource<T> : PositionalDataSource<T>() { | ||
|
||
protected lateinit var pageCallback: PageCallback<T> | ||
|
||
override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback<T>) { | ||
Timber.v("load range [${params.startPosition},${params.startPosition + params.loadSize}") | ||
pageCallback = object : PageCallback<T> { | ||
override fun onResult(items: List<T>) { | ||
callback.onResult(items) | ||
} | ||
} | ||
loadPage(LoadParam(params.startPosition, params.loadSize)) | ||
} | ||
|
||
override fun loadInitial(params: LoadInitialParams, callback: LoadInitialCallback<T>) { | ||
Timber.v("loadInitial size : ${params.pageSize}, reqested loaded size ${params.requestedLoadSize},start position ${params.requestedStartPosition}") | ||
pageCallback = object : PageCallback<T> { | ||
override fun onResult(items: List<T>) { | ||
callback.onResult(items, items.size) | ||
} | ||
} | ||
startInteractor() | ||
loadPage(LoadParam(params.requestedStartPosition, params.pageSize)) | ||
} | ||
|
||
abstract fun startInteractor() | ||
|
||
abstract fun loadPage(loadParam: LoadParam) | ||
|
||
abstract fun dispose() | ||
|
||
data class LoadParam(val start: Int, val size: Int) | ||
|
||
interface PageCallback<T> { | ||
fun onResult(items: List<T>) | ||
} | ||
} |
Oops, something went wrong.