-
Notifications
You must be signed in to change notification settings - Fork 66
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
40a7865
commit 317d899
Showing
13 changed files
with
303 additions
and
1 deletion.
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
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
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
17 changes: 17 additions & 0 deletions
17
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/aboutus/AboutUsActivity.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,17 @@ | ||
package org.mifos.mobile.cn.ui.mifos.aboutus | ||
|
||
import android.os.Bundle | ||
import kotlinx.android.synthetic.main.globalcontainer.* | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseActivity | ||
|
||
class AboutUsActivity: MifosBaseActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_toolbar_container) | ||
setToolbarTitle(getString(R.string.about_us)) | ||
showBackButton() | ||
replaceFragment(AboutUsFragment.newInstance(),false,R.id.container) | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/aboutus/AboutUsFragment.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,63 @@ | ||
package org.mifos.mobile.cn.ui.mifos.aboutus | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity | ||
import kotlinx.android.synthetic.main.fragment_about_us.* | ||
import org.mifos.mobile.cn.BuildConfig | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseActivity | ||
import org.mifos.mobile.cn.ui.base.MifosBaseFragment | ||
import org.mifos.mobile.cn.ui.mifos.privacypolicy.PrivacyPolicyActivity | ||
import java.util.* | ||
|
||
class AboutUsFragment : MifosBaseFragment(), View.OnClickListener { | ||
|
||
lateinit var rootview: View | ||
|
||
companion object { | ||
fun newInstance(): Fragment { | ||
val fragment: Fragment = AboutUsFragment() | ||
val args = Bundle() | ||
fragment.arguments = args | ||
return fragment | ||
} | ||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
rootview = inflater.inflate(R.layout.fragment_about_us, container, false) | ||
(activity as MifosBaseActivity).activityComponent.inject(this) | ||
setToolbarTitle(getString(R.string.about_us)) | ||
return rootview | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
tv_app_version.text = getString(R.string.app_version, BuildConfig.VERSION_NAME) | ||
tv_copy_right.text = getString(R.string.copy_right_mifos, Calendar.getInstance().get(Calendar.YEAR).toString()) | ||
tv_licenses.setOnClickListener(this) | ||
tv_privacy_policy.setOnClickListener(this) | ||
} | ||
|
||
override fun onClick(v: View?) { | ||
if (v != null) { | ||
when (v.id) { | ||
R.id.tv_licenses -> showOpenSourceLisences() | ||
R.id.tv_privacy_policy -> showPrivacyPolicy() | ||
} | ||
} | ||
} | ||
|
||
fun showOpenSourceLisences() { | ||
startActivity(Intent(activity, OssLicensesMenuActivity::class.java)) | ||
} | ||
|
||
fun showPrivacyPolicy() { | ||
startActivity(Intent(activity, PrivacyPolicyActivity::class.java)) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/privacypolicy/PrivacyPolicyActivity.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,66 @@ | ||
package org.mifos.mobile.cn.ui.mifos.privacypolicy | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Intent | ||
import android.graphics.Bitmap | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import android.view.View | ||
import android.webkit.WebView | ||
import android.webkit.WebViewClient | ||
import kotlinx.android.synthetic.main.activity_privacy_policy.* | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseActivity | ||
|
||
@SuppressLint("Registered") | ||
class PrivacyPolicyActivity: MifosBaseActivity() { | ||
private var showOrHideWebViewInitialUse = "show" | ||
|
||
@SuppressLint("SetJavaScriptEnabled") | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_privacy_policy) | ||
setToolbarTitle(getString(R.string.privacy_policy)) | ||
showBackButton() | ||
|
||
// Force links and redirects to open in the WebView instead of in a browser | ||
webView.webViewClient = WebViewClient() | ||
|
||
// Enable Javascript | ||
val webSettings = webView.settings | ||
webSettings.javaScriptEnabled = true | ||
|
||
// REMOTE RESOURCE | ||
webView.settings.domStorageEnabled = true | ||
webView.overScrollMode = WebView.OVER_SCROLL_NEVER | ||
webView.loadUrl(getString(R.string.privacy_policy_host_url)) | ||
webView.webViewClient = MyWebViewClient() | ||
} | ||
|
||
override fun onBackPressed() { | ||
if (webView.canGoBack()) { | ||
webView.goBack() | ||
} else { | ||
super.onBackPressed() | ||
} | ||
} | ||
|
||
internal inner class MyWebViewClient : WebViewClient() { | ||
|
||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { | ||
if (Uri.parse(url).host!! | ||
.endsWith(getString(R.string.privacy_policy_host))) { | ||
return false | ||
} | ||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) | ||
return true | ||
} | ||
|
||
override fun onPageFinished(view: WebView, url: String) { | ||
showOrHideWebViewInitialUse = "hide" | ||
progress_bar.visibility = View.GONE | ||
view.visibility = View.VISIBLE | ||
super.onPageFinished(view, url) | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- | ||
~ This project is licensed under the open source MPL V2. | ||
~ See https://github.com/openMF/self-service-app/blob/master/LICENSE.md | ||
--> | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:fitsSystemWindows="true" | ||
android:layout_height="match_parent" | ||
android:layout_width="match_parent"> | ||
|
||
<LinearLayout | ||
style="@style/LinearLayout.Base"> | ||
|
||
<include layout="@layout/toolbar"/> | ||
|
||
<androidx.coordinatorlayout.widget.CoordinatorLayout | ||
android:layout_height="match_parent" | ||
android:layout_width="match_parent"> | ||
|
||
<WebView | ||
android:id="@+id/webView" | ||
android:layout_alignParentBottom="true" | ||
android:layout_alignParentEnd="true" | ||
android:layout_alignParentLeft="true" | ||
android:layout_alignParentRight="true" | ||
android:layout_alignParentStart="true" | ||
android:layout_alignParentTop="true" | ||
android:layout_height="fill_parent" | ||
android:layout_width="fill_parent" | ||
android:visibility="gone"/> | ||
|
||
<ProgressBar | ||
android:id="@+id/progress_bar" | ||
android:layout_centerHorizontal="true" | ||
android:layout_centerInParent="true" | ||
android:layout_centerVertical="true" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content"/> | ||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
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,79 @@ | ||
<!-- | ||
~ This project is licensed under the open source MPL V2. | ||
~ See https://github.com/openMF/self-service-app/blob/master/LICENSE.md | ||
--> | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:background="@drawable/bg_about" | ||
android:layout_gravity="center" | ||
android:layout_height="match_parent" | ||
android:layout_width="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="@string/app_name" | ||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium" | ||
android:textColor="@color/black"/> | ||
|
||
<TextView | ||
style="@style/Base.TextAppearance.AppCompat.Small" | ||
android:id="@+id/tv_app_version" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="@string/app_version"/> | ||
|
||
<ImageView | ||
android:layout_width="132dp" | ||
android:layout_height="148dp" | ||
android:layout_gravity="center" | ||
android:layout_margin="@dimen/layout_padding_16dp" | ||
android:src="@drawable/mifos_logo_new" /> | ||
|
||
<TextView | ||
style="@style/Base.TextAppearance.AppCompat.Small" | ||
android:id="@+id/tv_copy_right" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="@string/copy_right_mifos"/> | ||
|
||
<TextView | ||
style="@style/Base.TextAppearance.AppCompat.Small" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="@string/all_rights_reserved"/> | ||
|
||
<TextView | ||
android:id="@+id/tv_licenses" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="@dimen/layout_padding_4dp" | ||
android:layout_marginTop="@dimen/layout_padding_48dp" | ||
android:layout_width="wrap_content" | ||
android:text="@string/licenses" | ||
android:textColor="@color/colorPrimary" | ||
android:textSize="@dimen/text_medium"/> | ||
|
||
<TextView | ||
android:id="@+id/tv_privacy_policy" | ||
android:layout_gravity="center" | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:text="@string/privacy_policy" | ||
android:textColor="@color/colorPrimary" | ||
android:textSize="@dimen/text_medium"/> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
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
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