Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  add help page option in drawer as well
  fix unit tests by moving zoho init to splash activity
  adjust login page button to not always be at bottom
  add string from zoho app id on build
  add custom theme with matching primary and accent colors
  add integration with the zoho desk sdk
  update play store listing
  • Loading branch information
shalzz committed Nov 18, 2019
2 parents 4458cc4 + 3fca9a0 commit 30bd6ee
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 20 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ android {
resValue("string", "app_name", "College Academics (debug)")
resValue("string", "contentAuthority", defaultConfig.applicationId + ".debug.provider")
resValue("string", "account_type", "com.shalzz.debug")
resValue("string", "zoho_app_id", "0cf0e6f11763c00d387ee247ab64aed483f3768859c3ef35")
buildConfigField("String", "ACCOUNT_TYPE", "\"com.shalzz.debug\"")
multiDexKeepProguard = file("./proguard/proguard-multidex-rules.pro")
signingConfig = signingConfigs.getByName("debug")
Expand All @@ -118,6 +119,7 @@ android {
resValue("string", "app_name", "College Academics")
resValue("string", "contentAuthority", defaultConfig.applicationId + ".provider")
resValue("string", "account_type", "com.shalzz")
resValue("string", "zoho_app_id", "0cf0e6f11763c00d387ee247ab64aed474712349653bbd5b")
buildConfigField("String", "ACCOUNT_TYPE", "\"com.shalzz\"")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
Expand Down Expand Up @@ -196,7 +198,7 @@ dependencies {

implementation("com.google.firebase:firebase-core:17.2.1")
implementation("com.google.firebase:firebase-analytics:17.2.1")
implementation("com.google.firebase:firebase-inappmessaging-display:19.0.1")
implementation("com.zoho.desk:asapsdk:1.1.4")

implementation("com.google.android.gms:play-services-oss-licenses:17.0.0")
implementation("com.google.android.material:material:1.0.0")
Expand Down
15 changes: 15 additions & 0 deletions app/proguard/proguard-zoho.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-keep class com.zoho.** {*;}
-keep interface android.support.v7.** { *; }
-keep class android.support.v7.** { *; }
-keep interface android.support.v4.** { *; }
-keep class android.support.v4.** { *; }
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.* { *; }
-keep interface okhttp3.* { *; }
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn com.zoho.accounts.**
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn retrofit2.**
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shalzz.attendance">
xmlns:tools="http://schemas.android.com/tools"
package="com.shalzz.attendance">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -41,6 +42,7 @@
android:anyDensity="true" />

<application
tools:replace="android:theme, android:supportsRtl, android:allowBackup"
android:name=".MyApplication"
android:allowClearUserData="true"
android:icon="@mipmap/ic_launcher"
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/shalzz/attendance/MyApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package com.shalzz.attendance;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

Expand All @@ -30,6 +29,8 @@
import com.shalzz.attendance.injection.component.DaggerApplicationComponent;
import com.shalzz.attendance.injection.module.ApplicationModule;
import com.shalzz.attendance.utils.BugsnagTree;
import com.zoho.deskportalsdk.DeskConfig;
import com.zoho.deskportalsdk.ZohoDeskPortalSDK;

import androidx.appcompat.app.AppCompatDelegate;
import androidx.multidex.MultiDexApplication;
Expand All @@ -39,6 +40,7 @@
public class MyApplication extends MultiDexApplication {

private static ApplicationComponent mApplicationComponent;
public static ZohoDeskPortalSDK deskInstance;

@Override
public void onCreate() {
Expand All @@ -55,6 +57,9 @@ public void onCreate() {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
FirebaseApp.initializeApp(this);

ZohoDeskPortalSDK.Logger.enableLogs();
deskInstance = ZohoDeskPortalSDK.getInstance(this);

if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ import android.accounts.AccountManager
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.appcompat.app.AppCompatDelegate
import com.google.firebase.analytics.FirebaseAnalytics
import com.shalzz.attendance.MyApplication
import com.shalzz.attendance.R
import com.shalzz.attendance.sync.AccountAuthenticatorActivity
import com.shalzz.attendance.sync.MyAccountManager
import kotlinx.android.synthetic.main.include_toolbar.*
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Named
Expand Down Expand Up @@ -56,6 +61,22 @@ class AuthenticatorActivity: AccountAuthenticatorActivity(),

mAccountManager = AccountManager.get(this)
mAuthTokenType = MyAccountManager.AUTHTOKEN_TYPE_READ_ONLY

setSupportActionBar(toolbar)
setTitle(null)
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.login, menu)
return super.onCreateOptionsMenu(menu)
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item!!.itemId == R.id.menu_help) {
MyApplication.deskInstance.startDeskHomeScreen(this)
return true
}
return super.onOptionsItemSelected(item)
}

override fun onFragmentInteraction(authToken: String, username: String, password: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ package com.shalzz.attendance.ui.login
import android.app.Activity
import android.content.Context
import android.os.Bundle
import android.util.Base64
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.*
import android.view.inputmethod.EditorInfo
import android.widget.AdapterView
import android.widget.ArrayAdapter
Expand All @@ -35,6 +32,7 @@ import com.bugsnag.android.Bugsnag
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
import com.google.firebase.analytics.FirebaseAnalytics
import com.shalzz.attendance.MyApplication
import com.shalzz.attendance.R
import com.shalzz.attendance.data.local.PreferencesHelper
import com.shalzz.attendance.data.model.College
Expand All @@ -44,6 +42,7 @@ import com.shalzz.attendance.utils.Miscellaneous
import com.shalzz.attendance.utils.Miscellaneous.Analytics
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.view.*
import kotlinx.android.synthetic.main.include_toolbar.*
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Named
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/shalzz/attendance/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.android.billingclient.api.BillingClient.BillingResponse
import com.bugsnag.android.Bugsnag
import com.github.amlcurran.showcaseview.ShowcaseView
import com.google.android.material.navigation.NavigationView
import com.shalzz.attendance.MyApplication
import com.shalzz.attendance.R
import com.shalzz.attendance.billing.BillingManager
import com.shalzz.attendance.billing.BillingProvider
Expand Down Expand Up @@ -170,15 +171,20 @@ class MainActivity : BaseActivity(), MainMvpView, BillingProvider {
navController: NavController
) {
navigationView.setNavigationItemSelectedListener { item ->
if (navController.currentDestination!!.id != item.itemId)
NavigationUI.onNavDestinationSelected(item, navController)
if (navController.currentDestination!!.id != item.itemId) {
if (item.itemId == R.id.helpNSupport) {
MyApplication.deskInstance.startDeskHomeScreen(this)
} else
NavigationUI.onNavDestinationSelected(item, navController)
}
val parent = navigationView.parent
(parent as DrawerLayout).closeDrawer(navigationView)
true
}
val weakReference = WeakReference(navigationView)
navController.addOnDestinationChangedListener(object : NavController.OnDestinationChangedListener {


override fun onDestinationChanged(controller: NavController,
destination: NavDestination,
arguments: Bundle?) {
Expand Down Expand Up @@ -261,6 +267,8 @@ class MainActivity : BaseActivity(), MainMvpView, BillingProvider {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_CANCELED)
finish()
else
navController.navigate(R.id.attendanceListFragment)
}

override fun setTitle(title: CharSequence) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import androidx.preference.PreferenceManager
import com.bugsnag.android.Bugsnag
import com.bugsnag.android.Severity
import com.google.firebase.analytics.FirebaseAnalytics
import com.shalzz.attendance.MyApplication
import com.shalzz.attendance.R
import com.shalzz.attendance.data.local.PreferencesHelper
import com.shalzz.attendance.sync.MyAccountManager
import com.shalzz.attendance.ui.base.BaseActivity
import com.shalzz.attendance.ui.main.MainActivity
import com.zoho.deskportalsdk.DeskConfig.Builder
import com.zoho.deskportalsdk.ZohoDeskPortalSDK
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Named
Expand All @@ -55,6 +58,13 @@ class SplashActivity : BaseActivity() {
mTracker.setAnalyticsCollectionEnabled(optIn)
Timber.i("Opted In to Google Analytics: %s", optIn)

val deskConfig = Builder().build()
MyApplication.deskInstance.setThemeResource(R.style.deskTheme)
MyApplication.deskInstance.initDesk(60002896708L,
getString(R.string.zoho_app_id),
ZohoDeskPortalSDK.DataCenter.IN,
deskConfig)

// Set all default values once for this application
try {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false)
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/play/listings/en-US/full-description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ View your current attendance and time table on the go with amazing and useful fe
Checking your attendance was never so pleasant.

College academics currently supports the following Colleges/Universities:
• Al-Habeeb College of Engineering & Technology
• Balaji Group of Colleges
• Geethanjali College of Engineering and Technology
• J.B Group of Educational Institutions
• KG Reddy College of Engineering and Technology
• Matrusri Engineering College
• MVSR Engineering College
• Mahatma Gandhi Institute of Technology
• Pearl Academy
• PSG Institute of Management
• St. Francis College for Women
• Siva Sivani Institute of Management
• The ICFAI University, Tripura
• Vaagdevi Institute of Technology & Science
• Vignana Jyothi Institute of Management

Features:
* One time login
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
android:background="@drawable/login_background"
tools:context=".ui.login.AuthenticatorActivity">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:subtitleTextAppearance="@style/MyActionBarSubTitleText"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@
android:id="@+id/etPassword"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
android:layout_marginTop="4dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:layout_marginRight="8dp"
app:errorEnabled="true"
app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etUserId">
Expand All @@ -132,12 +132,14 @@
android:layout_height="60dp"
android:gravity="center"
android:padding="5dp"
android:layout_marginTop="140dp"
android:paddingBottom="10dp"
android:text="@string/login_button"
app:cornerRadius="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etPassword"/>
app:layout_constraintTop_toBottomOf="@+id/etPassword"
app:layout_constraintVertical_bias="0.0" />

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
4 changes: 4 additions & 0 deletions app/src/main/res/menu/drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
android:id="@+id/settingsFragment"
android:orderInCategory="3"
android:title="@string/navigation_item_3"/>
<item
android:id="@+id/helpNSupport"
android:orderInCategory="4"
android:title="@string/navigation_item_4"/>
</group>

</menu>
30 changes: 30 additions & 0 deletions app/src/main/res/menu/login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2013-2019 Shaleen Jain <[email protected]>
~
~ This file is part of College Academics.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/menu_help"
android:orderInCategory="60"
android:icon="@drawable/ic_menu_questions"
app:iconTint="@color/white"
android:title="@string/menu_help"
app:showAsAction="ifRoom|collapseActionView"/>
</menu>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@
<string name="menu_logout">Log Out</string>
<string name="menu_refresh">Refresh</string>
<string name="menu_search">Search</string>
<string name="menu_help">Help Center</string>
<string name="menu_today">Scroll to today</string>
<string name="menu_date">Scroll to date</string>
<string name="navigation_item_1">Attendance</string>
<string name="navigation_item_2">Timetable</string>
<string name="navigation_item_3">Settings</string>
<string name="navigation_item_4">Help and Support</string>
<string name="proxy_settings_title">Proxy</string>
<string name="about_settings_title">About</string>

Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
<item name="android:shadowRadius">3.18</item>
</style>

<!-- Zoho Desk Styles -->

<style name="deskTheme" parent="deskTheme_Light">
<item name="colorPrimary">@color/primary </item>
<item name="colorPrimaryDark">@color/primary_dark </item>
<item name="colorAccent">@color/accent </item>
</style>

<!-- Showcase View Styles -->

<style name="ShowcaseTheme" parent="ShowcaseView">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
*/
public class DefaultConfig {
//The api level that Roboelectric will use to run the unit tests
public static final int EMULATE_SDK = 23;
public static final int EMULATE_SDK = 27;
}
Loading

0 comments on commit 30bd6ee

Please sign in to comment.