initial material design changes for the action bar

This commit is contained in:
AndyScherzinger 2015-07-26 01:49:27 +02:00
parent 82f4123260
commit d474239b21
33 changed files with 270 additions and 126 deletions

View file

@ -37,7 +37,7 @@
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>

View file

@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
@ -20,15 +20,15 @@ repositories {
dependencies {
compile name: 'touch-image-view'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:support-v4:22.2.1'
compile project(':owncloud-android-library')
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:appcompat-v7:22.2.1'
}
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
compileSdkVersion 22
buildToolsVersion "22.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'

View file

@ -8,6 +8,6 @@
# project structure.
# Project target.
target=android-19
target=android-22
android.library.reference.1=owncloud-android-library
android.library.reference.2=libs/android-support-appcompat-v7-exploded-aar

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,015 B

View file

@ -40,7 +40,6 @@
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="@color/login_logo_background_color"
android:src="@drawable/logo"
android:contentDescription="@string/app_name"/>
@ -63,6 +62,8 @@
android:text="@string/auth_expired_basic_auth_toast"
android:visibility="gone"
android:layout_marginBottom="10dp"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_expired_basic_auth_toast"/>
<FrameLayout
@ -80,6 +81,8 @@
android:inputType="textUri"
android:drawablePadding="5dp"
android:paddingRight="55dp"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_host_address"
>
<requestFocus />
@ -108,6 +111,8 @@
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:text="@string/auth_testing_connection"
android:contentDescription="@string/auth_testing_connection"/>
@ -119,6 +124,8 @@
android:onClick="onCheckClick"
android:text="@string/oauth_check_onoff"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/oauth_check_onoff"
/>
@ -128,6 +135,8 @@
android:layout_height="wrap_content"
android:ems="10"
android:enabled="false"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:text="@string/oauth2_url_endpoint_auth"
android:singleLine="true"
android:inputType="textUri"
@ -143,6 +152,8 @@
android:text="@string/oauth2_url_endpoint_access"
android:singleLine="true"
android:inputType="textUri"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:visibility="gone"/>
<EditText
@ -152,6 +163,8 @@
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_username"
/>
@ -163,6 +176,8 @@
android:ems="10"
android:hint="@string/auth_password"
android:inputType="textPassword"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_password"
/>
@ -175,6 +190,8 @@
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_unauthorized"/>
<Button
@ -196,7 +213,8 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/auth_register"
android:textColor="#0000FF"
android:textColor="#AAAAAA"
android:textColorHint="#AAAAAA"
android:contentDescription="@string/auth_register"/>
</LinearLayout>

View file

@ -16,51 +16,69 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/background_color"
android:baselineAligned="false"
android:clickable="true"
android:orientation="vertical"
android:fitsSystemWindows="true">
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="@+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:gravity="center"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:background="@color/background_color"
>
<!--TODO re-enable when "Accounts" is available in Navigation Drawer-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_margin="5dp">-->
<!--TODO re-enable when "Accounts" is available in Navigation Drawer-->
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_margin="5dp">-->
<!--<ImageView-->
<!--android:id="@+id/drawer_userIcon"-->
<!--android:layout_width="40dp"-->
<!--android:layout_height="40dp"-->
<!--android:src="@drawable/abc_ab_bottom_solid_dark_holo" />-->
<!--<ImageView-->
<!--android:id="@+id/drawer_userIcon"-->
<!--android:layout_width="40dp"-->
<!--android:layout_height="40dp"-->
<!--android:src="@drawable/abc_ab_bottom_solid_dark_holo" />-->
<!--<TextView-->
<!--android:id="@+id/drawer_username"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_marginLeft="5dp"-->
<!--android:layout_marginStart="5dp"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge" />-->
<!--</LinearLayout>-->
<!--<TextView-->
<!--android:id="@+id/drawer_username"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:layout_marginLeft="5dp"-->
<!--android:layout_marginStart="5dp"-->
<!--android:textAppearance="?android:attr/textAppearanceLarge" />-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="2dip"-->
<!--android:background="@color/list_item_lastmod_and_filesize_text" />-->
<!--</LinearLayout>-->
<ListView
android:id="@+id/drawer_list"
android:choiceMode="singleChoice"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
android:divider="#eee"
android:dividerHeight="1dp"
android:paddingTop="100dp" />
<!--<TextView-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="2dip"-->
<!--android:background="@color/list_item_lastmod_and_filesize_text" />-->
<ListView
android:id="@+id/drawer_list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
android:choiceMode="singleChoice"
/>
</LinearLayout>
<TextView
android:id="@+id/tv_header"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@color/owncloud_blue"
android:gravity="bottom"
android:orientation="vertical"
android:text="@string/app_name"
android:textColor="#FFF"
android:textStyle="bold"
android:padding="10dp"
android:textSize="24sp" />
</RelativeLayout>
</merge>

View file

@ -24,19 +24,28 @@
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:background="@color/background_color"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:minHeight="?android:attr/listPreferredItemHeight">
<ImageView
android:id="@+id/itemIcon"
android:layout_width="24sp"
android:layout_height="24sp"
android:layout_marginLeft="16sp"
android:layout_gravity="center_vertical"
/>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="@color/textColor"
android:textColor="@color/drawerMenuTextColor"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceListItem"
/>
</LinearLayout>

View file

@ -24,6 +24,15 @@
<color name="list_item_lastmod_and_filesize_text">#989898</color>
<color name="black">#000000</color>
<color name="textColor">#303030</color>
<color name="drawerMenuTextColor">#757575</color>
<color name="list_divider_background">#fff0f0f0</color>
<color name="owncloud_blue">#1D2D44</color>
<color name="login_text_color">#AAAAAA</color>
<!-- Colors -->
<color name="color_accent">@color/owncloud_blue_bright</color>
<!-- standard material color definitions -->
<color name="primary">@color/owncloud_blue</color>
<color name="primary_dark">#162233</color>
</resources>

View file

@ -28,6 +28,7 @@
<string name="drawer_item_settings">Settings</string>
<string name="drawer_item_logs">Logs</string>
<string name="drawer_close">Close</string>
<string name="drawer_open">Open</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">More</string>
<string name="prefs_accounts">Accounts</string>

View file

@ -25,10 +25,18 @@
<item name="android:actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
<item name="actionBarStyle">@style/Theme.ownCloud.Widget.ActionBar</item>
<item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/color_accent</item>
</style>
<style name="Theme.ownCloud.noActionBar" parent="style/Theme.AppCompat.Light">
<item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
<style name="Theme.ownCloud.noActionBar" parent="style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:buttonStyle">@style/Theme.ownCloud.ButtonStyle</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/color_accent</item>
</style>
<style name="Theme.ownCloud.Fullscreen" parent="style/Theme.AppCompat">
@ -38,7 +46,7 @@
<style name="Theme.ownCloud.Widget.ActionBar"
parent="style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/main_header_bg</item>
<item name="android:background">@color/owncloud_blue</item>
<item name="background">@drawable/main_header_bg</item>
<item name="android:textColor">#ffffff</item>
<item name="android:shadowColor">#222222</item>

View file

@ -24,6 +24,7 @@ public class NavigationDrawerItem {
private String mTitle;
private String mContentDescription;
private int mIcon;
// Constructors
public NavigationDrawerItem(){}
@ -32,9 +33,10 @@ public class NavigationDrawerItem {
mTitle = title;
}
public NavigationDrawerItem(String title, String contentDescription){
public NavigationDrawerItem(String title, String contentDescription, int icon){
mTitle = title;
mContentDescription = contentDescription;
mIcon = icon;
}
// Getters and Setters
@ -53,4 +55,12 @@ public class NavigationDrawerItem {
public void setContentDescription(String contentDescription) {
this.mContentDescription = contentDescription;
}
public int getIcon() {
return mIcon;
}
public void setIcon(int icon) {
this.mIcon = icon;
}
}

View file

@ -22,17 +22,15 @@
package com.owncloud.android.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Decision;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionMadeListener;
import com.owncloud.android.utils.DisplayUtils;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
/**
* Wrapper activity which will be launched if keep-in-sync file will be modified by external
@ -45,8 +43,6 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
}
@Override

View file

@ -35,18 +35,18 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.owncloud.android.BuildConfig;
@ -76,8 +76,6 @@ import com.owncloud.android.ui.NavigationDrawerItem;
import com.owncloud.android.ui.adapter.NavigationDrawerListAdapter;
import com.owncloud.android.ui.dialog.LoadingDialog;
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
import com.owncloud.android.ui.fragment.FileDetailFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.ErrorMessageAdapter;
import java.util.ArrayList;
@ -87,7 +85,7 @@ import java.util.ArrayList;
* Activity with common behaviour for activities handling {@link OCFile}s in ownCloud
* {@link Account}s .
*/
public class FileActivity extends ActionBarActivity
public class FileActivity extends AppCompatActivity
implements OnRemoteOperationListener, ComponentsGetter {
public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
@ -313,7 +311,7 @@ public class FileActivity extends ActionBarActivity
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
// Notification Drawer
LinearLayout navigationDrawerLayout = (LinearLayout) findViewById(R.id.left_drawer);
RelativeLayout navigationDrawerLayout = (RelativeLayout) findViewById(R.id.left_drawer);
mDrawerList = (ListView) navigationDrawerLayout.findViewById(R.id.drawer_list);
// TODO re-enable when "Accounts" is available in Navigation Drawer
@ -346,7 +344,8 @@ public class FileActivity extends ActionBarActivity
// mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0],
// mDrawerContentDescriptions[0]));
// All Files
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0]));
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[0], mDrawerContentDescriptions[0],
R.drawable.ic_folder_open));
// TODO Enable when "On Device" is recovered
// On Device
@ -354,11 +353,12 @@ public class FileActivity extends ActionBarActivity
// mDrawerContentDescriptions[2]));
// Settings
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1]));
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[1], mDrawerContentDescriptions[1],
R.drawable.ic_settings));
// Logs
if (BuildConfig.DEBUG) {
mDrawerItems.add(new NavigationDrawerItem(mDrawerTitles[2],
mDrawerContentDescriptions[2]));
mDrawerContentDescriptions[2],R.drawable.ic_log));
}
// setting the nav drawer list adapter
@ -366,12 +366,15 @@ public class FileActivity extends ActionBarActivity
mDrawerItems);
mDrawerList.setAdapter(mNavigationDrawerAdapter);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.drawable.ic_drawer,
R.string.app_name,
R.string.drawer_close) {
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,R.string.drawer_open,R.string.drawer_close) {
//new ActionBarDrawerToggle(
//this,
// mDrawerLayout,
// R.drawable.ic_drawer,
// R.string.app_name,
// R.string.drawer_close) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
@ -395,6 +398,7 @@ public class FileActivity extends ActionBarActivity
// Set the drawer toggle as the DrawerListener
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
/**

View file

@ -196,9 +196,15 @@ public class FileDisplayActivity extends HookActivity
// according to the official
// documentation
// enable ActionBar app icon to behave as action to toggle nav drawer
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress
/*|| mRefreshSharesInProgress*/);
// always AFTER setContentView(...) ; to work around bug in its implementation
initDrawer();
setBackgroundText();
@ -209,7 +215,6 @@ public class FileDisplayActivity extends HookActivity
protected void onStart() {
Log_OC.v(TAG, "onStart() start");
super.onStart();
getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
Log_OC.v(TAG, "onStart() end");
}
@ -1028,7 +1033,9 @@ public class FileDisplayActivity extends HookActivity
startImagePreview(getFile());
} // TODO what about other kind of previews?
}
setSupportProgressBarIndeterminate(false);
} finally {
if (intent != null) {
removeStickyBroadcast(intent);
@ -1166,7 +1173,6 @@ public class FileDisplayActivity extends HookActivity
}
@Override
protected ServiceConnection newTransferenceServiceConnection() {
return new ListServiceConnection();

View file

@ -59,7 +59,6 @@ import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
public class FolderPickerActivity extends FileActivity implements FileFragment.ContainerActivity,
@ -116,7 +115,6 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
@Override
protected void onStart() {
super.onStart();
getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
}
/**

View file

@ -81,9 +81,6 @@ public class GenericExplanationActivity extends ActionBarActivity {
} else {
listView.setVisibility(View.GONE);
}
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
}
public class ExplanationListAdapterView extends ArrayAdapter<String> {

View file

@ -72,9 +72,7 @@ public class LogHistoryActivity extends ActionBarActivity {
setContentView(R.layout.log_send_file);
setTitle(getText(R.string.actionbar_logger));
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
actionBar.setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Button deleteHistoryButton = (Button) findViewById(R.id.deleteLogHistoryButton);
Button sendHistoryButton = (Button) findViewById(R.id.sendLogHistoryButton);
TextView logTV = (TextView) findViewById(R.id.logTV);

View file

@ -128,9 +128,6 @@ public class PassCodeActivity extends ActionBarActivity {
}
setTextListeners();
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
}

View file

@ -32,8 +32,8 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -44,13 +44,18 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
//import android.support.v7.app.ActionBar;
import android.app.ActionBar;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListAdapter;
@ -75,6 +80,9 @@ import com.owncloud.android.utils.DisplayUtils;
/**
* An Activity that allows the user to change the application's settings.
*
* It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used
* with AppCompat.
*/
public class Preferences extends PreferenceActivity
implements AccountManagerCallback<Boolean>, ComponentsGetter {
@ -87,6 +95,7 @@ public class Preferences extends PreferenceActivity
private DbHandler mDbHandler;
private CheckBoxPreference pCode;
private Preference pAboutApp;
private AppCompatDelegate mDelegate;
private PreferenceCategory mAccountsPrefCategory = null;
private final Handler mHandler = new Handler();
@ -109,23 +118,15 @@ public class Preferences extends PreferenceActivity
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
mDbHandler = new DbHandler(getBaseContext());
addPreferencesFromResource(R.xml.preferences);
// Set properties of Action Bar in an ugly workaround to build correctly without
// upgrading minSdk
// TODO : increase minSdk; scheduled for next realease, don't wont to mix with this US
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
ActionBar actionBar = getActionBar();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
}
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.actionbar_settings);
} else {
setTitle(R.string.actionbar_settings);
}
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.actionbar_settings);
// For adding content description tag to a title field in the action bar
int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android");
@ -571,6 +572,61 @@ public class Preferences extends PreferenceActivity
}
}
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar);
}
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
getDelegate().setContentView(view);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().addContentView(view, params);
}
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
@Override
protected void onDestroy() {
mDbHandler.close();
@ -585,6 +641,24 @@ public class Preferences extends PreferenceActivity
}
super.onDestroy();
getDelegate().onDestroy();
}
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
private AppCompatDelegate getDelegate() {
if (mDelegate == null) {
mDelegate = AppCompatDelegate.create(this, null);
}
return mDelegate;
}
/**

View file

@ -117,7 +117,6 @@ public class UploadFilesActivity extends FileActivity implements
// Action bar setup
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
actionBar.setHomeButtonEnabled(true); // mandatory since Android ICS, according to the
// official documentation
actionBar.setDisplayHomeAsUpEnabled(mCurrentDir != null && mCurrentDir.getName() != null);

View file

@ -146,11 +146,6 @@ public class Uploader extends FileActivity
if (mAccountSelected) {
setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
}
ActionBar actionBar = getSupportActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
}
@Override

View file

@ -28,6 +28,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -102,12 +103,18 @@ public class NavigationDrawerListAdapter extends BaseAdapter {
NavigationDrawerItem navItem = (NavigationDrawerItem) mAll.get(position);
View view = inflator.inflate(R.layout.drawer_list_item, null);
view.setMinimumHeight(40);
LinearLayout itemLayout = (LinearLayout) view.findViewById(R.id.itemLayout);
itemLayout.setContentDescription(navItem.getContentDescription());
TextView itemText = (TextView) view.findViewById(R.id.itemTitle);
itemText.setText(navItem.getTitle());
if(navItem.getIcon()!=0) {
ImageView itemImage = (ImageView) view.findViewById(R.id.itemIcon);
itemImage.setImageResource(navItem.getIcon());
}
return view;
}
// TODO re-enable when "Accounts" is available in Navigation Drawer

View file

@ -28,7 +28,7 @@ import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import com.owncloud.android.R;
import com.owncloud.android.utils.DisplayUtils;
@ -91,7 +91,7 @@ public class ConflictsResolveDialog extends DialogFragment {
.create();
}
public void showDialog(ActionBarActivity activity) {
public void showDialog(AppCompatActivity activity) {
Fragment prev = activity.getSupportFragmentManager().findFragmentByTag("dialog");
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
if (prev != null) {
@ -102,7 +102,7 @@ public class ConflictsResolveDialog extends DialogFragment {
this.show(ft, "dialog");
}
public void dismissDialog(ActionBarActivity activity) {
public void dismissDialog(AppCompatActivity activity) {
Fragment prev = activity.getSupportFragmentManager().findFragmentByTag(getTag());
if (prev != null) {
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();