1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-07 07:56:14 +00:00

Drawer, Toolbar and minor UI optimizations (#145)

* initial add of toolbar and hamburger menu to main activity
* toolbar added to preferences and accounts screens
* fixed original string (name)
* Layout fix for content
* initial add of toolbar and hamburger menu to main activity
* remove unnecessary padding bottom
* fix styling and paint login activity in blue
* toolbar added to preferences and accounts screens
* Layout fix for content
* remove unnecessary padding bottom
* fix styling and paint login activity in blue
* fixes after rebase
* consolidate style since minVersion=16, make drawer to be behind the systembar
* optimize drawer header
* add back navigation to login activity, fix spinner background
* add back navigation
* more launcher icon to mipmap folders
* fix identation
* fix license header
* revert code style deletion, change identation
* proper notification icon
* proper resolution for login logo
* fix large notification icon
* removed unused Eclair switch since support is v16+
* only use small notification icon
* spaces->tabs
* fix toolbar style for Android 4.x
This commit is contained in:
Andy Scherzinger 2017-03-23 20:16:31 +01:00 committed by Loïc Blot
parent 0bc671901e
commit f83eebe4dd
35 changed files with 570 additions and 322 deletions

51
notification_icon.svg Normal file
View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 0 0 595.275 311.111"
xml:space="preserve"
height="546.13336"
width="546.13336"
version="1.1"
y="0px"
x="0px"
id="svg2"
viewBox="0 0 512 512"
inkscape:version="0.92.1 r15371"
sodipodi:docname="notification_icon.svg"
inkscape:export-filename="C:\DEV\src\Android\Nextcloud\ownCloud-SMS-App\src\main\res\drawable-xxxhdpi\notification_icon.png"
inkscape:export-xdpi="16.879999"
inkscape:export-ydpi="16.879999"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1005"
id="namedview6"
showgrid="false"
inkscape:zoom="1.4739747"
inkscape:cx="140.31712"
inkscape:cy="253.09893"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><path
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.30745259;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0"
d="m 76.647972,90.431718 c -24.788364,0 -44.743887,15.887432 -44.743887,35.621852 v 161.78969 c 0,19.73444 19.955523,35.62188 44.743887,35.62188 H 128.01232 L 332.84234,465.77569 266.5124,323.46514 h 168.83961 c 24.7884,0 44.7439,-15.88744 44.7439,-35.62188 V 126.05357 c 0,-19.73442 -19.9555,-35.621852 -44.7439,-35.621852 z M 88.80753,121.0557 h 334.38495 c 12.20514,0 22.03089,6.58929 22.03089,14.77376 v 9.61145 c 0,8.1845 -9.82575,14.77187 -22.03089,14.77187 H 88.80753 c -12.205149,0 -22.030913,-6.58737 -22.030913,-14.77187 v -9.61145 c 0,-8.18447 9.825764,-14.77376 22.030913,-14.77376 z m 0,68.10616 h 334.38495 c 12.20514,0 22.03089,6.5893 22.03089,14.77378 v 9.60954 c 0,8.18448 -9.82575,14.77377 -22.03089,14.77377 H 88.80753 c -12.205149,0 -22.030913,-6.58929 -22.030913,-14.77377 v -9.60954 c 0,-8.18448 9.825764,-14.77378 22.030913,-14.77378 z m 0,67.54597 h 120.79949 c 12.20514,0 22.03088,8.99072 22.03088,17.17521 v 7.20812 c 0,8.18446 -9.82574,14.77376 -22.03088,14.77376 H 88.80753 c -12.205149,0 -22.030913,-6.5893 -22.030913,-14.77376 v -7.20812 c 0,-8.18449 9.825764,-17.17521 22.030913,-17.17521 z"
id="rect3350"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssscccssssssssssssssssssssssssssssssss" /></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -124,7 +124,8 @@
<activity <activity
android:name=".activities.LoginActivity" android:name=".activities.LoginActivity"
android:label="@string/title_activity_login"> android:label="@string/title_activity_login"
android:theme="@style/OcSmsTheme.Login">
</activity> </activity>
<activity <activity
android:name=".activities.remote_account.AccountListActivity" android:name=".activities.remote_account.AccountListActivity"
@ -136,7 +137,8 @@
</activity> </activity>
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
android:label="@string/app_name"> android:label="@string/app_name"
android:theme="@style/OcSmsTheme.Drawer">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>

View File

@ -29,10 +29,12 @@ import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
@ -65,7 +67,7 @@ public class LoginActivity extends AppCompatActivity {
private EditText _loginView; private EditText _loginView;
private EditText _passwordView; private EditText _passwordView;
private EditText _serverView; private EditText _serverView;
private ActionProcessButton _signInButton; private ActionProcessButton _signInButton;
private View mProgressView; private View mProgressView;
private View mLoginFormView; private View mLoginFormView;
@ -74,6 +76,9 @@ public class LoginActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
// Set up the login form. // Set up the login form.
_protocolView = (Spinner) findViewById(R.id.oc_protocol); _protocolView = (Spinner) findViewById(R.id.oc_protocol);
_serverView = (EditText) findViewById(R.id.oc_server); _serverView = (EditText) findViewById(R.id.oc_server);
@ -84,7 +89,7 @@ public class LoginActivity extends AppCompatActivity {
.setOnEditorActionListener(new TextView.OnEditorActionListener() { .setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int id, public boolean onEditorAction(TextView textView, int id,
KeyEvent keyEvent) { KeyEvent keyEvent) {
if ((id == R.id.oc_login) || (id == EditorInfo.IME_NULL)) { if ((id == R.id.oc_login) || (id == EditorInfo.IME_NULL)) {
attemptLogin(); attemptLogin();
return true; return true;
@ -93,7 +98,7 @@ public class LoginActivity extends AppCompatActivity {
} }
}); });
_signInButton = (ActionProcessButton) findViewById(R.id.oc_signin_button); _signInButton = (ActionProcessButton) findViewById(R.id.oc_signin_button);
_signInButton.setOnClickListener(new OnClickListener() { _signInButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -105,6 +110,19 @@ public class LoginActivity extends AppCompatActivity {
mProgressView = findViewById(R.id.login_progress); mProgressView = findViewById(R.id.login_progress);
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
retval = super.onOptionsItemSelected(item);
}
return retval;
}
/** /**
* Attempts to sign in or register the account specified by the login form. * Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the * If there are form errors (invalid email, missing fields, etc.), the
@ -163,15 +181,15 @@ public class LoginActivity extends AppCompatActivity {
if (cancel) { if (cancel) {
// There was an error; don't attempt login and focus the first // There was an error; don't attempt login and focus the first
// form field with an error. // form field with an error.
// reset the button progress // reset the button progress
_signInButton.setProgress(0); _signInButton.setProgress(0);
if (focusView != null) { if (focusView != null) {
focusView.requestFocus(); focusView.requestFocus();
} }
} else { } else {
// Show a progress spinner, and kick off a background task to // Show a progress spinner, and kick off a background task to
// perform the user login attempt. // perform the user login attempt.
_signInButton.setProgress(25); _signInButton.setProgress(25);
showProgress(true); showProgress(true);
String serverURL = protocol + serverAddr; String serverURL = protocol + serverAddr;
mAuthTask = new UserLoginTask(serverURL, login, password); mAuthTask = new UserLoginTask(serverURL, login, password);
@ -232,7 +250,7 @@ public class LoginActivity extends AppCompatActivity {
public class UserLoginTask extends AsyncTask<Void, Void, Boolean> { public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
UserLoginTask(String serverURI, String login, String password) { UserLoginTask(String serverURI, String login, String password) {
Log.i(TAG, "_serverURI = " + serverURI); Log.i(TAG, "_serverURI = " + serverURI);
_serverURI = Uri.parse(serverURI); _serverURI = Uri.parse(serverURI);
_login = login; _login = login;
_password = password; _password = password;
@ -259,14 +277,14 @@ public class LoginActivity extends AppCompatActivity {
protected void onPostExecute(Boolean success) { protected void onPostExecute(Boolean success) {
mAuthTask = null; mAuthTask = null;
showProgress(false); showProgress(false);
_signInButton.setProgress(90); _signInButton.setProgress(90);
if (success) { if (success) {
_signInButton.setProgress(100); _signInButton.setProgress(100);
String accountType = getIntent().getStringExtra(UserLoginTask.PARAM_AUTHTOKEN_TYPE); String accountType = getIntent().getStringExtra(UserLoginTask.PARAM_AUTHTOKEN_TYPE);
if (accountType == null) { if (accountType == null) {
accountType = getString(R.string.account_type); accountType = getString(R.string.account_type);
} }
// Generate a label // Generate a label
String accountLabel = _login + "@" + _serverURI.getHost(); String accountLabel = _login + "@" + _serverURI.getHost();
@ -296,10 +314,10 @@ public class LoginActivity extends AppCompatActivity {
settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(settingsIntent); getApplicationContext().startActivity(settingsIntent);
} else { } else {
boolean serverViewRequestFocus = true; boolean serverViewRequestFocus = true;
switch (_returnCode) { switch (_returnCode) {
case 0: case 0:
_serverView.setError("UNK"); _serverView.setError("UNK");
break; break;
case 404: case 404:
_serverView.setError(getString(R.string.error_connection_failed_not_found)); _serverView.setError(getString(R.string.error_connection_failed_not_found));
@ -312,24 +330,24 @@ public class LoginActivity extends AppCompatActivity {
_serverView.setError(getString(R.string.error_http_connection_failed)); _serverView.setError(getString(R.string.error_http_connection_failed));
break; break;
case 401: case 401:
case 403: case 403:
_passwordView.setError(getString(R.string.error_invalid_login)); _passwordView.setError(getString(R.string.error_invalid_login));
_passwordView.requestFocus(); _passwordView.requestFocus();
// Warning, there is no break here to disable serverViewRequestFocus too // Warning, there is no break here to disable serverViewRequestFocus too
case 200: case 200:
default: default:
serverViewRequestFocus = false; serverViewRequestFocus = false;
break; break;
} }
if (serverViewRequestFocus) { if (serverViewRequestFocus) {
_serverView.requestFocus(); _serverView.requestFocus();
} }
// If not ok, reset the progress // If not ok, reset the progress
if (_returnCode != 200) { if (_returnCode != 200) {
_signInButton.setProgress(0); _signInButton.setProgress(0);
} }
} }
} }
@ -345,6 +363,6 @@ public class LoginActivity extends AppCompatActivity {
private int _returnCode; private int _returnCode;
static final String PARAM_AUTHTOKEN_TYPE = "auth.token"; static final String PARAM_AUTHTOKEN_TYPE = "auth.token";
private final String TAG = UserLoginTask.class.getCanonicalName(); private final String TAG = UserLoginTask.class.getCanonicalName();
} }
} }

View File

@ -38,6 +38,7 @@ import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.Window; import android.view.Window;
@ -59,107 +60,174 @@ import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_MAX;
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_SMS; import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_SMS;
public class MainActivity extends AppCompatActivity public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener{ implements NavigationView.OnNavigationItemSelectedListener {
private ConnectivityMonitor _ConnectivityMonitor = null;
private DrawerLayout drawer;
private ConnectivityMonitor _ConnectivityMonitor = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
if (_ConnectivityMonitor == null) { if (_ConnectivityMonitor == null) {
_ConnectivityMonitor = new ConnectivityMonitor(getApplicationContext()); _ConnectivityMonitor = new ConnectivityMonitor(getApplicationContext());
} }
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, null, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
assert drawer != null;
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); setupToolbar();
assert navigationView != null; getSupportActionBar().setHomeButtonEnabled(true);
navigationView.setNavigationItemSelectedListener(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
drawer.openDrawer(GravityCompat.START); drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
setupDrawer();
drawer.openDrawer(GravityCompat.START);
} }
@Override protected void setupToolbar() {
public void onBackPressed() { setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); }
assert drawer != null;
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override private void setupDrawer() {
public boolean onNavigationItemSelected(MenuItem item) { ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
int id = item.getItemId(); this, drawer, null, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
boolean res = true; assert drawer != null;
drawer.addDrawerListener(toggle);
toggle.syncState();
toggle.setDrawerIndicatorEnabled(true);
switch (id) { NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
case R.id.nav_sync: syncAllMessages(); break; assert navigationView != null;
case R.id.nav_manage: res = openAppSettings(); break; navigationView.setNavigationItemSelectedListener(this);
case R.id.nav_rateus: res = openGooglePlayStore(); break; }
case R.id.nav_add_account: res = openAddAccount(); break;
case R.id.nav_my_accounts: res = openMyAccounts(); break;
case R.id.nav_appinfo_perms: res = openAppInfos(); break;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
assert drawer != null;
drawer.closeDrawer(GravityCompat.START);
return res;
}
private boolean openAppSettings () { /**
* checks if the drawer exists and is opened.
*
* @return <code>true</code> if the drawer is open, else <code>false</code>
*/
public boolean isDrawerOpen() {
return drawer != null && drawer.isDrawerOpen(GravityCompat.START);
}
/**
* closes the drawer.
*/
public void closeDrawer() {
if (drawer != null) {
drawer.closeDrawer(GravityCompat.START);
}
}
/**
* opens the drawer.
*/
public void openDrawer() {
if (drawer != null) {
drawer.openDrawer(GravityCompat.START);
}
}
@Override
public void onBackPressed() {
if (isDrawerOpen()) {
closeDrawer();
} else {
super.onBackPressed();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
switch (item.getItemId()) {
case android.R.id.home: {
if (isDrawerOpen()) {
closeDrawer();
} else {
openDrawer();
}
break;
}
default:
retval = super.onOptionsItemSelected(item);
}
return retval;
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
boolean res = true;
switch (id) {
case R.id.nav_sync:
syncAllMessages();
break;
case R.id.nav_manage:
res = openAppSettings();
break;
case R.id.nav_rateus:
res = openGooglePlayStore();
break;
case R.id.nav_add_account:
res = openAddAccount();
break;
case R.id.nav_my_accounts:
res = openMyAccounts();
break;
case R.id.nav_appinfo_perms:
res = openAppInfos();
break;
}
closeDrawer();
return res;
}
private boolean openAppSettings() {
startActivity(new Intent(this, OCSMSSettingsActivity.class)); startActivity(new Intent(this, OCSMSSettingsActivity.class));
return true; return true;
} }
private boolean openAddAccount () { private boolean openAddAccount() {
startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
return true; return true;
} }
public void syncAllMessages () { public void syncAllMessages() {
Log.v(MainActivity.TAG, "Launch syncAllMessages()"); Log.v(MainActivity.TAG, "Launch syncAllMessages()");
if (!PermissionChecker.checkPermission(this, Manifest.permission.READ_SMS, if (!PermissionChecker.checkPermission(this, Manifest.permission.READ_SMS,
REQUEST_SMS)) { REQUEST_SMS)) {
return; return;
} }
Context ctx = getApplicationContext(); Context ctx = getApplicationContext();
if (_ConnectivityMonitor.isValid()) { if (_ConnectivityMonitor.isValid()) {
// Now fetch messages since last stored date // Now fetch messages since last stored date
JSONArray smsList = new JSONArray(); JSONArray smsList = new JSONArray();
new AndroidSmsFetcher(ctx).bufferMessagesSinceDate(smsList, (long) 0); new AndroidSmsFetcher(ctx).bufferMessagesSinceDate(smsList, (long) 0);
if (smsList.length() > 0) { if (smsList.length() > 0) {
OCSMSNotificationUI.notify(ctx, ctx.getString(R.string.sync_title), OCSMSNotificationUI.notify(ctx, ctx.getString(R.string.sync_title),
ctx.getString(R.string.sync_inprogress), OCSMSNotificationType.SYNC.ordinal()); ctx.getString(R.string.sync_inprogress), OCSMSNotificationType.SYNC.ordinal());
new SyncTask(getApplicationContext(), smsList).execute(); new SyncTask(getApplicationContext(), smsList).execute();
} else {
Toast.makeText(ctx, ctx.getString(R.string.nothing_to_sync), Toast.LENGTH_SHORT).show();
} }
else { } else {
Toast.makeText(ctx, ctx.getString(R.string.nothing_to_sync), Toast.LENGTH_SHORT).show();
}
}
else {
Toast.makeText(ctx, ctx.getString(R.string.err_sync_no_connection_available), Toast.LENGTH_SHORT).show(); Toast.makeText(ctx, ctx.getString(R.string.err_sync_no_connection_available), Toast.LENGTH_SHORT).show();
} }
Log.v(MainActivity.TAG, "Finish syncAllMessages()"); Log.v(MainActivity.TAG, "Finish syncAllMessages()");
} }
private boolean openMyAccounts () { private boolean openMyAccounts() {
startActivity(new Intent(this, AccountListActivity.class)); startActivity(new Intent(this, AccountListActivity.class));
return true; return true;
} }
private boolean openGooglePlayStore () { private boolean openGooglePlayStore() {
Intent intent; Intent intent;
try { try {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())); intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()));
@ -168,45 +236,45 @@ public class MainActivity extends AppCompatActivity
} }
startActivity(intent); startActivity(intent);
return true; return true;
} }
private boolean openAppInfos () { private boolean openAppInfos() {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null); Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri); intent.setData(uri);
startActivity(intent); startActivity(intent);
return true; return true;
} }
/* /*
* Permissions * Permissions
*/ */
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) { @NonNull int[] grantResults) {
PermissionID requestCodeID = REQUEST_MAX; PermissionID requestCodeID = REQUEST_MAX;
if ((requestCode > 0) || (requestCode < REQUEST_MAX.ordinal())) { if ((requestCode > 0) || (requestCode < REQUEST_MAX.ordinal())) {
requestCodeID = PermissionID.values()[requestCode]; requestCodeID = PermissionID.values()[requestCode];
} }
switch (requestCodeID) { switch (requestCodeID) {
case REQUEST_SMS: case REQUEST_SMS:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
syncAllMessages(); syncAllMessages();
} else { } else {
// Permission Denied // Permission Denied
Toast.makeText(this, getString(R.string.err_cannot_read_sms) + " " + Toast.makeText(this, getString(R.string.err_cannot_read_sms) + " " +
getString(R.string.please_fix_it), Toast.LENGTH_SHORT) getString(R.string.please_fix_it), Toast.LENGTH_SHORT)
.show(); .show();
} }
break; break;
default: default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults);
} }
} }
private static final String TAG = MainActivity.class.getSimpleName(); private static final String TAG = MainActivity.class.getSimpleName();
} }

View File

@ -24,7 +24,10 @@ import android.content.ContentResolver;
import android.content.PeriodicSync; import android.content.PeriodicSync;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.util.Log; import android.util.Log;
import android.view.MenuItem;
import java.util.List; import java.util.List;
@ -37,82 +40,104 @@ import fr.unix_experience.owncloud_sms.prefs.PermissionChecker;
import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_ACCOUNTS; import static fr.unix_experience.owncloud_sms.enums.PermissionID.REQUEST_ACCOUNTS;
public class OCSMSSettingsActivity extends VirtualSettingsActivity { public class OCSMSSettingsActivity extends VirtualSettingsActivity {
private static final String TAG = OCSMSSettingsActivity.class.getSimpleName(); private static final String TAG = OCSMSSettingsActivity.class.getSimpleName();
private static AccountManager _accountMgr; private static AccountManager _accountMgr;
private static String _accountAuthority; private static String _accountAuthority;
private static String _accountType; private static String _accountType;
@Override private AppCompatDelegate mDelegate;
protected void onPostCreate(Bundle savedInstanceState) {
OCSMSSettingsActivity._accountMgr = AccountManager.get(getBaseContext());
OCSMSSettingsActivity._accountAuthority = getString(R.string.account_authority);
OCSMSSettingsActivity._accountType = getString(R.string.account_type);
VirtualSettingsActivity._prefsRessourceFile = R.xml.pref_data_sync;
// Bind our boolean preferences @SuppressWarnings("deprecation")
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("push_on_receive", DefaultPrefs.pushOnReceive)); @Override
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_wifi", DefaultPrefs.syncWifi)); public void onCreate(Bundle savedInstanceState) {
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_4g", DefaultPrefs.sync4G)); super.onCreate(savedInstanceState);
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_3g", DefaultPrefs.sync3G));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_gprs", DefaultPrefs.syncGPRS));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_2g", DefaultPrefs.sync2G));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_others", DefaultPrefs.syncOthers));
// Bind our string preferences ActionBar actionBar = getSupportActionBar();
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("sync_frequency", "15")); actionBar.setDisplayHomeAsUpEnabled(true);
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("sync_bulk_messages", "-1")); }
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("minimum_sync_chars", "1"));
// Must be at the end, after preference bind private AppCompatDelegate getDelegate() {
super.onPostCreate(savedInstanceState); if (mDelegate == null) {
} mDelegate = AppCompatDelegate.create(this, null);
}
return mDelegate;
}
protected void handleCheckboxPreference(String key, Boolean value) { public ActionBar getSupportActionBar() {
// Network types allowed for sync return getDelegate().getSupportActionBar();
if ("push_on_receive".equals(key) || }
"sync_wifi".equals(key) || "sync_2g".equals(key) ||
"sync_3g".equals(key) || "sync_gprs".equals(key) ||
"sync_4g".equals(key) || "sync_others".equals(key)) {
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context);
Log.i(OCSMSSettingsActivity.TAG, "OCSMSSettingsActivity.handleCheckboxPreference: set " + key + " to "
+ value.toString());
prefs.putBoolean(key, value);
}
}
protected void handleListPreference(String key, String value, @Override
ListPreference preference) { protected void onPostCreate(Bundle savedInstanceState) {
// For list preferences, look up the correct display value in OCSMSSettingsActivity._accountMgr = AccountManager.get(getBaseContext());
// the preference's 'entries' list. OCSMSSettingsActivity._accountAuthority = getString(R.string.account_authority);
int index = preference.findIndexOfValue(value); OCSMSSettingsActivity._accountType = getString(R.string.account_type);
VirtualSettingsActivity._prefsRessourceFile = R.xml.pref_data_sync;
// Set the summary to reflect the new value. // Bind our boolean preferences
preference VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("push_on_receive", DefaultPrefs.pushOnReceive));
.setSummary((index >= 0) ? preference.getEntries()[index] VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_wifi", DefaultPrefs.syncWifi));
: null); VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_4g", DefaultPrefs.sync4G));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_3g", DefaultPrefs.sync3G));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_gprs", DefaultPrefs.syncGPRS));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_2g", DefaultPrefs.sync2G));
VirtualSettingsActivity._boolPrefs.add(new BindObjectPref("sync_others", DefaultPrefs.syncOthers));
Log.i(OCSMSSettingsActivity.TAG, "Modifying listPreference " + key); // Bind our string preferences
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("sync_frequency", "15"));
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("sync_bulk_messages", "-1"));
VirtualSettingsActivity._stringPrefs.add(new BindObjectPref("minimum_sync_chars", "1"));
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context); // Must be at the end, after preference bind
super.onPostCreate(savedInstanceState);
}
// Handle sync frequency change protected void handleCheckboxPreference(String key, Boolean value) {
if ("sync_frequency".equals(key)) { // Network types allowed for sync
if (!PermissionChecker.checkPermission(this, Manifest.permission.GET_ACCOUNTS, if ("push_on_receive".equals(key) ||
REQUEST_ACCOUNTS)) { "sync_wifi".equals(key) || "sync_2g".equals(key) ||
return; "sync_3g".equals(key) || "sync_gprs".equals(key) ||
} "sync_4g".equals(key) || "sync_others".equals(key)) {
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context);
Log.i(OCSMSSettingsActivity.TAG, "OCSMSSettingsActivity.handleCheckboxPreference: set " + key + " to "
+ value.toString());
prefs.putBoolean(key, value);
}
}
Account[] myAccountList = OCSMSSettingsActivity._accountMgr.getAccountsByType(OCSMSSettingsActivity._accountType); protected void handleListPreference(String key, String value,
long syncFreq = Long.parseLong(value); ListPreference preference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
int index = preference.findIndexOfValue(value);
// Set the summary to reflect the new value.
preference
.setSummary((index >= 0) ? preference.getEntries()[index]
: null);
Log.i(OCSMSSettingsActivity.TAG, "Modifying listPreference " + key);
OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(VirtualSettingsActivity._context);
// Handle sync frequency change
if ("sync_frequency".equals(key)) {
if (!PermissionChecker.checkPermission(this, Manifest.permission.GET_ACCOUNTS,
REQUEST_ACCOUNTS)) {
return;
}
Account[] myAccountList = OCSMSSettingsActivity._accountMgr.getAccountsByType(OCSMSSettingsActivity._accountType);
long syncFreq = Long.parseLong(value);
// Get ownCloud SMS account list // Get ownCloud SMS account list
for (Account acct: myAccountList) { for (Account acct : myAccountList) {
// And get all authorities for this account // And get all authorities for this account
List<PeriodicSync> syncList = ContentResolver.getPeriodicSyncs(acct, OCSMSSettingsActivity._accountAuthority); List<PeriodicSync> syncList = ContentResolver.getPeriodicSyncs(acct, OCSMSSettingsActivity._accountAuthority);
boolean foundSameSyncCycle = false; boolean foundSameSyncCycle = false;
for (PeriodicSync ps: syncList) { for (PeriodicSync ps : syncList) {
if ((ps.period == syncFreq) && (ps.extras.getInt("synctype") == 1)) { if ((ps.period == syncFreq) && (ps.extras.getInt("synctype") == 1)) {
foundSameSyncCycle = true; foundSameSyncCycle = true;
} }
@ -123,16 +148,29 @@ public class OCSMSSettingsActivity extends VirtualSettingsActivity {
b.putInt("synctype", 1); b.putInt("synctype", 1);
ContentResolver.removePeriodicSync(acct, OCSMSSettingsActivity._accountAuthority, b); ContentResolver.removePeriodicSync(acct, OCSMSSettingsActivity._accountAuthority, b);
if (syncFreq > 0) { if (syncFreq > 0) {
ContentResolver.addPeriodicSync(acct, OCSMSSettingsActivity._accountAuthority, b, syncFreq * 60); ContentResolver.addPeriodicSync(acct, OCSMSSettingsActivity._accountAuthority, b, syncFreq * 60);
} }
} }
prefs.putLong(key, syncFreq); prefs.putLong(key, syncFreq);
} }
} else if ("sync_bulk_messages".equals(key) || "minimum_sync_chars".equals(key)) {
prefs.putInteger(key, Integer.parseInt(value));
} }
else if ("sync_bulk_messages".equals(key) || "minimum_sync_chars".equals(key)) { }
prefs.putInteger(key, Integer.parseInt(value));
} @Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
super.onMenuItemSelected(featureId, item);
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
default:
return false;
}
return true;
} }
} }

View File

@ -2,7 +2,9 @@ package fr.unix_experience.owncloud_sms.activities.remote_account;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.util.Log; import android.util.Log;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
@ -19,6 +21,9 @@ public class AccountActionsActivity extends AppCompatListActivity {
setContentView(R.layout.activity_account_actions); setContentView(R.layout.activity_account_actions);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
ArrayList<String> itemList = new ArrayList<>(); ArrayList<String> itemList = new ArrayList<>();
ArrayAdapter<String> adp = new ArrayAdapter<>(getBaseContext(), ArrayAdapter<String> adp = new ArrayAdapter<>(getBaseContext(),
android.R.layout.simple_dropdown_item_1line, itemList); android.R.layout.simple_dropdown_item_1line, itemList);
@ -33,20 +38,33 @@ public class AccountActionsActivity extends AppCompatListActivity {
_accountName = getIntent().getStringExtra("account"); _accountName = getIntent().getStringExtra("account");
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
retval = super.onOptionsItemSelected(item);
}
return retval;
}
@Override @Override
protected void onListItemClick(ListView l, View v, int position, long id) { protected void onListItemClick(ListView l, View v, int position, long id) {
switch (position) { switch (position) {
case 0: case 0:
Intent intent = new Intent(this, RestoreMessagesActivity.class); Intent intent = new Intent(this, RestoreMessagesActivity.class);
intent.putExtra("account", _accountName); intent.putExtra("account", _accountName);
try { try {
startActivity(intent); startActivity(intent);
} } catch (IllegalStateException e) {
catch (IllegalStateException e) { Log.e(AccountActionsActivity.TAG, e.getMessage());
Log.e(AccountActionsActivity.TAG, e.getMessage()); }
}
break; break;
default: break; // Unhandled default:
break; // Unhandled
} }
} }

View File

@ -3,13 +3,14 @@ package fr.unix_experience.owncloud_sms.activities.remote_account;
import android.accounts.Account; import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import fr.unix_experience.owncloud_sms.adapters.AndroidAccountAdapter;
import fr.unix_experience.android_lib.AppCompatListActivity; import fr.unix_experience.android_lib.AppCompatListActivity;
import fr.unix_experience.owncloud_sms.R; import fr.unix_experience.owncloud_sms.R;
import fr.unix_experience.owncloud_sms.adapters.AndroidAccountAdapter;
public class AccountListActivity extends AppCompatListActivity { public class AccountListActivity extends AppCompatListActivity {
@ -21,21 +22,35 @@ public class AccountListActivity extends AppCompatListActivity {
setContentView(R.layout.restore_activity_accountlist); setContentView(R.layout.restore_activity_accountlist);
ArrayList<Account> itemList = new ArrayList<>(); getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AndroidAccountAdapter adapter = new AndroidAccountAdapter(this, ArrayList<Account> itemList = new ArrayList<>();
AndroidAccountAdapter adapter = new AndroidAccountAdapter(this,
android.R.layout.simple_list_item_1, android.R.layout.simple_list_item_1,
itemList, itemList,
R.layout.account_list_item, R.layout.account_list_item,
R.id.accountname, AccountActionsActivity.class); R.id.accountname, AccountActionsActivity.class);
setListAdapter(adapter); setListAdapter(adapter);
Account[] accountList = Account[] accountList =
_accountMgr.getAccountsByType(getString(R.string.account_type)); _accountMgr.getAccountsByType(getString(R.string.account_type));
Collections.addAll(itemList, accountList); Collections.addAll(itemList, accountList);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
} }
} }

View File

@ -26,8 +26,10 @@ import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Telephony; import android.provider.Telephony;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -49,6 +51,9 @@ public class RestoreMessagesActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_restore_messages); setContentView(R.layout.activity_restore_messages);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
assert getIntent().getExtras() != null; assert getIntent().getExtras() != null;
String accountName = getIntent().getExtras().getString("account"); String accountName = getIntent().getExtras().getString("account");
@ -111,6 +116,19 @@ public class RestoreMessagesActivity extends AppCompatActivity {
}); });
} }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
default:
retval = super.onOptionsItemSelected(item);
}
return retval;
}
private void initInterface() { private void initInterface() {
TextView tv_error = (TextView) findViewById(R.id.tv_error_default_smsapp); TextView tv_error = (TextView) findViewById(R.id.tv_error_default_smsapp);
tv_error.setText(R.string.error_make_default_sms_app); tv_error.setText(R.string.error_make_default_sms_app);
@ -132,8 +150,7 @@ public class RestoreMessagesActivity extends AppCompatActivity {
tv_error.setVisibility(View.VISIBLE); tv_error.setVisibility(View.VISIBLE);
fix_button.setVisibility(View.VISIBLE); fix_button.setVisibility(View.VISIBLE);
launch_restore.setVisibility(View.INVISIBLE); launch_restore.setVisibility(View.INVISIBLE);
} } else {
else {
tv_error.setVisibility(View.INVISIBLE); tv_error.setVisibility(View.INVISIBLE);
fix_button.setVisibility(View.INVISIBLE); fix_button.setVisibility(View.INVISIBLE);
launch_restore.setVisibility(View.VISIBLE); launch_restore.setVisibility(View.VISIBLE);

View File

@ -3,13 +3,10 @@ package fr.unix_experience.owncloud_sms.notifications;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
@ -40,7 +37,7 @@ public class OCSMSNotificationUI {
// This image is used as the notification's large icon (thumbnail). // This image is used as the notification's large icon (thumbnail).
// TODO: Remove this if your notification has no relevant thumbnail. // TODO: Remove this if your notification has no relevant thumbnail.
Bitmap picture = BitmapFactory.decodeResource(res, R.drawable.ic_launcher); Bitmap picture = BitmapFactory.decodeResource(res, R.mipmap.ic_launcher);
String ticker = (titleString.length() > 20) ? titleString.substring(0, 20) : titleString; String ticker = (titleString.length() > 20) ? titleString.substring(0, 20) : titleString;
@ -50,31 +47,28 @@ public class OCSMSNotificationUI {
// Set appropriate defaults for the notification light, sound, // Set appropriate defaults for the notification light, sound,
// and vibration. // and vibration.
.setSmallIcon(R.drawable.ic_launcher) .setSmallIcon(R.drawable.notification_icon)
.setContentTitle(title) .setContentTitle(title)
.setContentText(contentString) .setContentText(contentString)
// All fields below this line are optional. // All fields below this line are optional.
// Use a default priority (recognized on devices running Android // Use a default priority (recognized on devices running Android
// 4.1 or later) // 4.1 or later)
.setPriority(NotificationCompat.PRIORITY_DEFAULT) .setPriority(NotificationCompat.PRIORITY_DEFAULT)
// Provide a large icon, shown with the notification in the // Set ticker text (preview) information for this notification.
// notification drawer on devices running Android 3.0 or later.
.setLargeIcon(picture)
// Set ticker text (preview) information for this notification.
//.setTicker(ticker) //.setTicker(ticker)
// Show a number. This is useful when stacking notifications of // Show a number. This is useful when stacking notifications of
// a single type. // a single type.
.setNumber(number) .setNumber(number)
.setStyle(new NotificationCompat.BigTextStyle() .setStyle(new NotificationCompat.BigTextStyle()
.bigText(contentString) .bigText(contentString)
.setBigContentTitle(title) .setBigContentTitle(title)
.setSummaryText(titleString)) .setSummaryText(titleString))
.setAutoCancel(true); .setAutoCancel(true)
.setColor(context.getResources().getColor(R.color.oc_primary));
OCSMSNotificationUI.notify(context, builder.build()); OCSMSNotificationUI.notify(context, builder.build());
} }
@ -83,25 +77,17 @@ public class OCSMSNotificationUI {
private static void notify(Context context, Notification notification) { private static void notify(Context context, Notification notification) {
NotificationManager nm = (NotificationManager) context NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { nm.notify(OCSMSNotificationUI.NOTIFICATION_TAG, 0, notification);
nm.notify(OCSMSNotificationUI.NOTIFICATION_TAG, 0, notification);
} else {
nm.notify(OCSMSNotificationUI.NOTIFICATION_TAG.hashCode(), notification);
}
} }
/** /**
* Cancels any notifications of this type previously shown using * Cancels any notifications of this type previously shown using
* {@link #notify(Context, String, int)}. * {@link #notify(Context, String, String, int)}.
*/ */
@TargetApi(Build.VERSION_CODES.ECLAIR) @TargetApi(Build.VERSION_CODES.ECLAIR)
public static void cancel(Context context) { public static void cancel(Context context) {
NotificationManager nm = (NotificationManager) context NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { nm.cancel(OCSMSNotificationUI.NOTIFICATION_TAG, 0);
nm.cancel(OCSMSNotificationUI.NOTIFICATION_TAG, 0);
} else {
nm.cancel(OCSMSNotificationUI.NOTIFICATION_TAG.hashCode());
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -61,7 +61,9 @@
android:id="@+id/ocsms_logo" android:id="@+id/ocsms_logo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/login_logo" android:paddingTop="24dp"
android:paddingBottom="36dp"
android:src="@drawable/logo"
android:contentDescription="@string/login_logo" /> android:contentDescription="@string/login_logo" />
<LinearLayout <LinearLayout
@ -73,8 +75,9 @@
android:id="@+id/oc_protocol" android:id="@+id/oc_protocol"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:entries="@array/protocol_array"> android:layout_gravity="center_vertical"
</Spinner> android:popupBackground="@color/oc_primary"
android:entries="@array/protocol_array" />
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -84,6 +87,7 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/prompt_serverURI" android:hint="@string/prompt_serverURI"
android:textColor="@color/oc_white"
android:inputType="textUri" > android:inputType="textUri" >
<requestFocus /> <requestFocus />
</EditText> </EditText>
@ -99,9 +103,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/prompt_login" android:hint="@string/prompt_login"
android:textColor="@color/oc_white"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:maxLines="1" android:maxLines="1" />
android:singleLine="true" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout <android.support.design.widget.TextInputLayout
@ -117,7 +121,7 @@
android:imeOptions="actionUnspecified" android:imeOptions="actionUnspecified"
android:inputType="textPassword" android:inputType="textPassword"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" /> android:textColor="@color/oc_white" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<com.dd.processbutton.iml.ActionProcessButton <com.dd.processbutton.iml.ActionProcessButton

View File

@ -34,9 +34,14 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:openDrawer="start" tools:openDrawer="start"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar" />
<TextView <TextView
android:id="@+id/main_title_welcome" android:id="@+id/main_title_welcome"
@ -44,7 +49,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/ma_title_welcome" android:text="@string/ma_title_welcome"
android:gravity="top"
android:textAppearance="?android:attr/textAppearanceLarge" /> android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView <TextView
@ -53,26 +57,9 @@
android:paddingRight="16dp" android:paddingRight="16dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="top"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/main_title_welcome"
android:text="@string/ma_content_welcome" android:text="@string/ma_content_welcome"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<TextView
android:id="@+id/main_tv_swipe"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/main_tv_welcome"
android:text="@string/ma_content_swipeaction"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<android.support.design.widget.NavigationView <android.support.design.widget.NavigationView
android:id="@+id/nav_view" android:id="@+id/nav_view"
@ -81,5 +68,5 @@
android:layout_gravity="start" android:layout_gravity="start"
app:headerLayout="@layout/nav_header_main" app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" app:menu="@menu/activity_main_drawer"
android:fitsSystemWindows="false"/> android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

View File

@ -3,24 +3,21 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height" android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar" android:background="@drawable/side_nav_bar"
android:gravity="top" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin" android:padding="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/ic_launcher"/> android:src="@drawable/ic_launcher"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:paddingTop="@dimen/standard_half_padding"
android:text="@string/app_name" android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/> android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>

View File

@ -6,6 +6,6 @@
android:id="@+id/recovery_phone" android:id="@+id/recovery_phone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="20dp" android:padding="@dimen/activity_vertical_margin"
android:textSize="18sp" /> android:textSize="18sp"/>
</RelativeLayout> </RelativeLayout>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- <!--
/* /*
* Copyright (c) 2017, Andy Scherzinger
* Copyright (c) 2014-2015, Loic Blot <loic.blot@unix-experience.fr> * Copyright (c) 2014-2015, Loic Blot <loic.blot@unix-experience.fr>
* All rights reserved. * All rights reserved.
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -24,11 +26,28 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
--> -->
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<resources> <android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<style name="OcSmsTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <ProgressBar
<item name="colorPrimary">@color/oc_primary</item> android:id="@+id/login_progress"
<item name="colorPrimaryDark">@color/oc_primary_dark</item> style="?android:attr/progressBarStyleLarge"
</style> android:layout_width="wrap_content"
</resources> android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
</android.support.design.widget.AppBarLayout>

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -97,7 +97,7 @@
<string name="ma_title_rate_us">Rate us !</string> <string name="ma_title_rate_us">Rate us !</string>
<string name="ma_title_add_account">Add an account</string> <string name="ma_title_add_account">Add an account</string>
<string name="ma_title_welcome">Welcome</string> <string name="ma_title_welcome">Welcome</string>
<string name="ma_content_welcome">Welcome to ownCloud SMS application. This application let you synchronize your SMS to your ownCloud instance using SMS app.</string> <string name="ma_content_welcome">Welcome to Nextcloud SMS application. This application let you synchronize your SMS to your Nextcloud instance using SMS app.</string>
<!-- Notifications --> <!-- Notifications -->
<string name="sync_title">Sync process</string> <string name="sync_title">Sync process</string>

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:navigationBarColor">@color/oc_primary</item>
<item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorPrimary">@color/oc_primary</item>
</style>
<style name="OcSmsTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="OcSmsTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/oc_primary</item> <item name="colorPrimary">@color/oc_primary</item>
<item name="colorPrimaryDark">@color/oc_primary_dark</item> <item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorAccent">@color/oc_accent</item>
<item name="android:navigationBarColor">@color/oc_primary</item> <item name="android:navigationBarColor">@color/oc_primary</item>
</style> </style>
>
<style name="OcSmsTheme.NoActionBar"> <style name="OcSmsTheme.Drawer" parent="OcSmsTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
</style> </style>
<style name="OcSmsTheme.NoActionBar">
<item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorPrimary">@color/oc_primary</item>
<item name="colorAccent">@color/oc_accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
</resources> </resources>

View File

@ -6,5 +6,5 @@
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
--> -->
<dimen name="activity_horizontal_margin">64dp</dimen> <dimen name="activity_horizontal_margin">64dp</dimen>
<dimen name="nav_drawer_header_height">164dp</dimen>
</resources> </resources>

View File

@ -2,4 +2,7 @@
<resources> <resources>
<color name="oc_primary">#0082C9</color> <color name="oc_primary">#0082C9</color>
<color name="oc_primary_dark">#006AA3</color> <color name="oc_primary_dark">#006AA3</color>
<color name="oc_accent">#007CC2</color>
<color name="oc_login_hint">#7fC0E3</color>
<color name="oc_white">#ffffff</color>
</resources> </resources>

View File

@ -6,7 +6,8 @@
<dimen name="arrow_max_height">22dp</dimen> <dimen name="arrow_max_height">22dp</dimen>
<!-- Default screen margins, per the Android Design guidelines. --> <!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="nav_header_vertical_spacing">16dp</dimen> <dimen name="nav_header_vertical_spacing">16dp</dimen>
<dimen name="nav_header_height">120dp</dimen> <dimen name="standard_half_padding">8dp</dimen>
<dimen name="nav_header_height">140dp</dimen>
<dimen name="fab_margin">16dp</dimen> <dimen name="fab_margin">16dp</dimen>
</resources> </resources>

View File

@ -27,15 +27,39 @@
<resources> <resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="OcSmsTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorPrimary">@color/oc_primary</item> <item name="colorPrimary">@color/oc_primary</item>
</style> <item name="colorPrimaryDark">@color/oc_primary_dark</item>
<!-- Application theme. --> <item name="colorAccent">@color/oc_accent</item>
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style> </style>
<!-- separate style for Drawer activities needed for v21+ theming -->
<style name="OcSmsTheme.Drawer" parent="OcSmsTheme.NoActionBar">
<item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorPrimary">@color/oc_primary</item>
<item name="colorAccent">@color/oc_accent</item>
</style>
<style name="OcSmsTheme.NoActionbar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">@color/oc_primary_dark</item>
<item name="colorPrimary">@color/oc_primary</item>
<item name="colorAccent">@color/oc_accent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="OcSmsTheme.Login" parent="OcSmsTheme">
<item name="android:windowBackground">@color/oc_primary</item>
<item name="colorControlNormal">@color/oc_login_hint</item>
<item name="colorControlActivated">@color/oc_white</item>
<item name="colorControlHighlight">@color/oc_login_hint</item>
<item name="colorAccent">@color/oc_login_hint</item>
<item name="android:textColorHint">@color/oc_login_hint</item>
<item name="android:textColor">@color/oc_white</item>
</style>
<!-- Application theme. -->
<style name="StandardButton"> <style name="StandardButton">
<item name="android:background">@color/oc_primary</item> <item name="android:background">@color/oc_primary</item>
<item name="android:layout_marginTop">15dp</item> <item name="android:layout_marginTop">15dp</item>
@ -52,7 +76,7 @@
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item> <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
</style> </style>
<style name="OcSmsTheme.NoActionBar"> <style name="OcSmsTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>