Material Design: Full screen dialogs
@ -1,3 +1,9 @@
|
||||
# https://google.github.io/material-design-icons/
|
||||
cd ./android-icon-copier/
|
||||
python copy OpenKeychain action white search 24
|
||||
python copy OpenKeychain navigation white arrow_back 24
|
||||
python copy OpenKeychain navigation white arrow_back 24
|
||||
python copy OpenKeychain navigation white close 24
|
||||
python copy OpenKeychain navigation white check 24
|
||||
python copy OpenKeychain navigation black expand_less 24
|
||||
python copy OpenKeychain navigation black expand_more 24
|
||||
python copy OpenKeychain navigation white refresh 24
|
||||
|
@ -27,7 +27,6 @@ import android.view.View;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
@ -45,14 +44,18 @@ public class AccountSettingsActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.api_settings_save, R.drawable.ic_action_done,
|
||||
setFullScreenDialogDoneClose(R.string.api_settings_save,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// "Done"
|
||||
save();
|
||||
}
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -129,9 +132,4 @@ public class AccountSettingsActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
save();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import org.sufficientlysecure.keychain.remote.AccountSettings;
|
||||
import org.sufficientlysecure.keychain.remote.AppSettings;
|
||||
import org.sufficientlysecure.keychain.ui.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.SelectPublicKeyFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
@ -123,8 +122,8 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
mAppSettingsFragment.setAppSettings(settings);
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(getSupportActionBar(),
|
||||
R.string.api_register_allow, R.drawable.ic_action_done,
|
||||
setFullScreenDialogTwoButtons(
|
||||
R.string.api_register_allow, R.drawable.ic_check_white_24dp,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -137,7 +136,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
RemoteServiceActivity.this.setResult(RESULT_OK, resultData);
|
||||
RemoteServiceActivity.this.finish();
|
||||
}
|
||||
}, R.string.api_register_disallow, R.drawable.ic_action_cancel,
|
||||
}, R.string.api_register_disallow, R.drawable.ic_close_white_24dp,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -179,8 +178,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
mAccSettingsFragment.setAccSettings(settings);
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(getSupportActionBar(),
|
||||
R.string.api_settings_save, R.drawable.ic_action_done,
|
||||
setFullScreenDialogDoneClose(R.string.api_settings_save,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -208,7 +206,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
RemoteServiceActivity.this.finish();
|
||||
}
|
||||
}
|
||||
}, R.string.api_settings_cancel, R.drawable.ic_action_cancel,
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -216,8 +214,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
RemoteServiceActivity.this.setResult(RESULT_CANCELED);
|
||||
RemoteServiceActivity.this.finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
@ -264,8 +261,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
initToolbar();
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(getSupportActionBar(),
|
||||
R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogDoneClose(R.string.btn_okay,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -277,16 +273,15 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
RemoteServiceActivity.this.setResult(RESULT_OK, resultData);
|
||||
RemoteServiceActivity.this.finish();
|
||||
}
|
||||
}, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() {
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// cancel
|
||||
RemoteServiceActivity.this.setResult(RESULT_CANCELED);
|
||||
RemoteServiceActivity.this.finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
// set text on view
|
||||
TextView textView = (TextView) findViewById(R.id.api_select_pub_keys_text);
|
||||
@ -323,8 +318,7 @@ public class RemoteServiceActivity extends BaseActivity {
|
||||
initToolbar();
|
||||
|
||||
// Inflate a "Done" custom action bar view
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogClose(
|
||||
new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
|
@ -17,14 +17,21 @@
|
||||
|
||||
package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
||||
/**
|
||||
* Sets action bar
|
||||
* Setups Toolbar
|
||||
*/
|
||||
public abstract class BaseActivity extends ActionBarActivity {
|
||||
protected Toolbar mToolbar;
|
||||
@ -49,4 +56,75 @@ public abstract class BaseActivity extends ActionBarActivity {
|
||||
protected void setActionBarIcon(int iconRes) {
|
||||
mToolbar.setNavigationIcon(iconRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inflate custom design to look like a full screen dialog, as specified in Material Design Guidelines
|
||||
* see http://www.google.com/design/spec/components/dialogs.html#dialogs-full-screen-dialogs
|
||||
*/
|
||||
protected void setFullScreenDialogDoneClose(int doneText, View.OnClickListener doneOnClickListener,
|
||||
View.OnClickListener cancelOnClickListener) {
|
||||
setActionBarIcon(R.drawable.ic_close_white_24dp);
|
||||
|
||||
// Inflate the custom action bar view
|
||||
final LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext()
|
||||
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
final View customActionBarView = inflater.inflate(R.layout.full_screen_dialog, null);
|
||||
|
||||
TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.full_screen_dialog_done_text));
|
||||
firstTextView.setText(doneText);
|
||||
customActionBarView.findViewById(R.id.full_screen_dialog_done).setOnClickListener(
|
||||
doneOnClickListener);
|
||||
|
||||
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||
getSupportActionBar().setCustomView(customActionBarView, new ActionBar.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
Gravity.END));
|
||||
mToolbar.setNavigationOnClickListener(cancelOnClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close button only
|
||||
*/
|
||||
protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener) {
|
||||
setActionBarIcon(R.drawable.ic_close_white_24dp);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(true);
|
||||
mToolbar.setNavigationOnClickListener(cancelOnClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inflate custom design with two buttons using drawables.
|
||||
* This does not conform to the Material Design Guidelines, but we deviate here as this is used
|
||||
* to indicate "Allow access"/"Disallow access" to the API, which must be clearly indicated
|
||||
*/
|
||||
protected void setFullScreenDialogTwoButtons(int firstText, int firstDrawableId, View.OnClickListener firstOnClickListener,
|
||||
int secondText, int secondDrawableId, View.OnClickListener secondOnClickListener) {
|
||||
|
||||
// Inflate the custom action bar view
|
||||
final LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext()
|
||||
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
final View customActionBarView = inflater.inflate(
|
||||
R.layout.full_screen_dialog_2, null);
|
||||
|
||||
TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text));
|
||||
firstTextView.setText(firstText);
|
||||
firstTextView.setCompoundDrawablesWithIntrinsicBounds(firstDrawableId, 0, 0, 0);
|
||||
customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(
|
||||
firstOnClickListener);
|
||||
TextView secondTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text));
|
||||
secondTextView.setText(secondText);
|
||||
secondTextView.setCompoundDrawablesWithIntrinsicBounds(secondDrawableId, 0, 0, 0);
|
||||
customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(
|
||||
secondOnClickListener);
|
||||
|
||||
// Show the custom action bar view and hide the normal Home icon and title.
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(false);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
getSupportActionBar().setDisplayShowCustomEnabled(true);
|
||||
getSupportActionBar().setCustomView(customActionBarView, new ActionBar.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import android.os.Messenger;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -66,7 +65,6 @@ import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.EditSubkeyExpiryDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
@ -148,10 +146,8 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(((ActionBarActivity) getActivity()).getSupportActionBar(),
|
||||
R.string.btn_save, R.drawable.ic_action_save,
|
||||
((EditKeyActivity) getActivity()).setFullScreenDialogDoneClose(
|
||||
R.string.btn_save,
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -162,16 +158,13 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
saveInDatabase(mCurrentPassphrase);
|
||||
}
|
||||
}
|
||||
}, R.string.menu_key_edit_cancel, R.drawable.ic_action_cancel,
|
||||
new OnClickListener() {
|
||||
}, new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// cancel
|
||||
getActivity().setResult(Activity.RESULT_CANCELED);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Uri dataUri = getArguments().getParcelable(ARG_DATA_URI);
|
||||
SaveKeyringParcel saveKeyringParcel = getArguments().getParcelable(ARG_SAVE_KEYRING_PARCEL);
|
||||
@ -393,8 +386,8 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
|
||||
// cache new returned passphrase!
|
||||
mSaveKeyringParcel.mNewUnlock = new ChangeUnlockParcel(
|
||||
data.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE),
|
||||
null
|
||||
data.getString(SetPassphraseDialogFragment.MESSAGE_NEW_PASSPHRASE),
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
|
||||
public class LogDisplayActivity extends BaseActivity {
|
||||
|
||||
@ -31,8 +30,7 @@ public class LogDisplayActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogClose(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -26,7 +26,6 @@ import android.widget.ImageView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
@ -44,8 +43,7 @@ public class QrCodeViewActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogClose(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -24,7 +24,6 @@ import android.view.View;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
|
||||
public class SelectPublicKeyActivity extends BaseActivity {
|
||||
|
||||
@ -46,21 +45,19 @@ public class SelectPublicKeyActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogDoneClose(R.string.btn_okay,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ok
|
||||
okClicked();
|
||||
}
|
||||
}, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() {
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// cancel
|
||||
cancelClicked();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
||||
|
||||
|
@ -27,7 +27,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.ui.widget.Editor;
|
||||
import org.sufficientlysecure.keychain.ui.widget.Editor.EditorListener;
|
||||
import org.sufficientlysecure.keychain.ui.widget.KeyServerEditor;
|
||||
@ -51,21 +50,19 @@ public class SettingsKeyServerActivity extends BaseActivity implements OnClickLi
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Inflate a "Done"/"Cancel" custom action bar view
|
||||
ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogDoneClose(R.string.btn_save,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// ok
|
||||
okClicked();
|
||||
}
|
||||
}, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() {
|
||||
},
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// cancel
|
||||
cancelClicked();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
|
@ -25,7 +25,6 @@ import android.view.View;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.ActionBarHelper;
|
||||
import org.sufficientlysecure.keychain.util.ExportHelper;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
@ -42,8 +41,7 @@ public class ViewKeyAdvancedActivity extends BaseActivity {
|
||||
mProviderHelper = new ProviderHelper(this);
|
||||
|
||||
// Inflate a "Done" custom action bar
|
||||
ActionBarHelper.setOneButtonView(getSupportActionBar(),
|
||||
R.string.btn_okay, R.drawable.ic_action_done,
|
||||
setFullScreenDialogClose(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -164,7 +164,7 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
? mSaveKeyringParcel.getSubkeyChange(keyId)
|
||||
: null;
|
||||
|
||||
if (change.mDummyStrip) {
|
||||
if (change != null && change.mDummyStrip) {
|
||||
algorithmStr.append(", ");
|
||||
final SpannableString boldStripped = new SpannableString(
|
||||
context.getString(R.string.key_stripped)
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
package org.sufficientlysecure.keychain.ui.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
|
||||
public class ActionBarHelper {
|
||||
|
||||
/**
|
||||
* Sets custom view on ActionBar for Done/Cancel activities
|
||||
*
|
||||
* @param actionBar
|
||||
* @param firstText
|
||||
* @param firstDrawableId
|
||||
* @param firstOnClickListener
|
||||
* @param secondText
|
||||
* @param secondDrawableId
|
||||
* @param secondOnClickListener
|
||||
*/
|
||||
public static void setTwoButtonView(ActionBar actionBar,
|
||||
int firstText, int firstDrawableId, OnClickListener firstOnClickListener,
|
||||
int secondText, int secondDrawableId, OnClickListener secondOnClickListener) {
|
||||
|
||||
// Inflate the custom action bar view
|
||||
final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext()
|
||||
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
final View customActionBarView = inflater.inflate(
|
||||
R.layout.actionbar_custom_view_done_cancel, null);
|
||||
|
||||
TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text));
|
||||
firstTextView.setText(firstText);
|
||||
firstTextView.setCompoundDrawablesWithIntrinsicBounds(firstDrawableId, 0, 0, 0);
|
||||
customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(
|
||||
firstOnClickListener);
|
||||
TextView secondTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text));
|
||||
secondTextView.setText(secondText);
|
||||
secondTextView.setCompoundDrawablesWithIntrinsicBounds(secondDrawableId, 0, 0, 0);
|
||||
customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener(
|
||||
secondOnClickListener);
|
||||
|
||||
// Show the custom action bar view and hide the normal Home icon and title.
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(false);
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets custom view on ActionBar for Done activities
|
||||
*
|
||||
* @param actionBar
|
||||
* @param firstText
|
||||
* @param firstOnClickListener
|
||||
*/
|
||||
public static void setOneButtonView(ActionBar actionBar, int firstText, int firstDrawableId,
|
||||
OnClickListener firstOnClickListener) {
|
||||
// Inflate a "Done" custom action bar view to serve as the "Up" affordance.
|
||||
final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext()
|
||||
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
final View customActionBarView = inflater
|
||||
.inflate(R.layout.actionbar_custom_view_done, null);
|
||||
|
||||
TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text));
|
||||
firstTextView.setText(firstText);
|
||||
firstTextView.setCompoundDrawablesWithIntrinsicBounds(firstDrawableId, 0, 0, 0);
|
||||
customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener(
|
||||
firstOnClickListener);
|
||||
|
||||
// Show the custom action bar view and hide the normal Home icon and title.
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(false);
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
actionBar.setCustomView(customActionBarView);
|
||||
}
|
||||
}
|
@ -33,17 +33,16 @@ import org.sufficientlysecure.keychain.R;
|
||||
/**
|
||||
* Class representing a LinearLayout that can fold and hide it's content when pressed
|
||||
* To use just add the following to your xml layout
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
custom:foldedLabel="@string/TEXT_TO_DISPLAY_WHEN_FOLDED"
|
||||
custom:unFoldedLabel="@string/TEXT_TO_DISPLAY_WHEN_UNFOLDED">
|
||||
|
||||
<include layout="@layout/ELEMENTS_TO_BE_FOLDED"/>
|
||||
|
||||
</org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout>
|
||||
|
||||
* <p/>
|
||||
* <org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout
|
||||
* android:layout_width="wrap_content"
|
||||
* android:layout_height="wrap_content"
|
||||
* custom:foldedLabel="@string/TEXT_TO_DISPLAY_WHEN_FOLDED"
|
||||
* custom:unFoldedLabel="@string/TEXT_TO_DISPLAY_WHEN_UNFOLDED">
|
||||
* <p/>
|
||||
* <include layout="@layout/ELEMENTS_TO_BE_FOLDED"/>
|
||||
* <p/>
|
||||
* </org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout>
|
||||
*/
|
||||
public class FoldableLinearLayout extends LinearLayout {
|
||||
|
||||
@ -75,6 +74,7 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
|
||||
/**
|
||||
* Load given attributes to inner variables,
|
||||
*
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
@ -87,8 +87,8 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
a.recycle();
|
||||
}
|
||||
// If any attribute isn't found then set a default one
|
||||
mFoldedLabel = (mFoldedLabel == null) ? context.getString(R.id.none) : mFoldedLabel;
|
||||
mUnFoldedLabel = (mUnFoldedLabel == null) ? context.getString(R.id.none) : mUnFoldedLabel;
|
||||
mFoldedLabel = (mFoldedLabel == null) ? context.getString(R.string.none) : mFoldedLabel;
|
||||
mUnFoldedLabel = (mUnFoldedLabel == null) ? context.getString(R.string.none) : mUnFoldedLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,7 +138,7 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
|
||||
private void initialiseInnerViews() {
|
||||
mFoldableIcon = (ImageView) mFoldableLayout.findViewById(R.id.foldableIcon);
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_action_expand);
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_expand_more_black_24dp);
|
||||
mFoldableTextView = (TextView) mFoldableLayout.findViewById(R.id.foldableText);
|
||||
mFoldableTextView.setText(mFoldedLabel);
|
||||
|
||||
@ -151,7 +151,7 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
public void onClick(View view) {
|
||||
mFolded = !mFolded;
|
||||
if (mFolded) {
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_action_collapse);
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_expand_less_black_24dp);
|
||||
mFoldableContainer.setVisibility(View.VISIBLE);
|
||||
AlphaAnimation animation = new AlphaAnimation(0f, 1f);
|
||||
animation.setDuration(mShortAnimationDuration);
|
||||
@ -159,12 +159,13 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
mFoldableTextView.setText(mUnFoldedLabel);
|
||||
|
||||
} else {
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_action_expand);
|
||||
mFoldableIcon.setImageResource(R.drawable.ic_expand_more_black_24dp);
|
||||
AlphaAnimation animation = new AlphaAnimation(1f, 0f);
|
||||
animation.setDuration(mShortAnimationDuration);
|
||||
animation.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) { }
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
@ -173,7 +174,8 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) { }
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
});
|
||||
mFoldableContainer.startAnimation(animation);
|
||||
mFoldableTextView.setText(mFoldedLabel);
|
||||
@ -185,6 +187,7 @@ public class FoldableLinearLayout extends LinearLayout {
|
||||
|
||||
/**
|
||||
* Adds provided child view to foldableContainer View
|
||||
*
|
||||
* @param child
|
||||
*/
|
||||
@Override
|
||||
|
Before Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 415 B |
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_check_white_24dp.png
Normal file
After Width: | Height: | Size: 309 B |
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_close_white_24dp.png
Normal file
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 345 B |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_check_white_24dp.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_close_white_24dp.png
Normal file
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 206 B |
After Width: | Height: | Size: 206 B |
After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 582 B |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_check_white_24dp.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_close_white_24dp.png
Normal file
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 259 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 901 B |
Before Width: | Height: | Size: 974 B |
After Width: | Height: | Size: 460 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 316 B |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 587 B |
After Width: | Height: | Size: 662 B |
After Width: | Height: | Size: 360 B |
After Width: | Height: | Size: 379 B |
After Width: | Height: | Size: 1.1 KiB |
@ -1,26 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerPadding="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="end" >
|
||||
|
||||
<include layout="@layout/actionbar_include_done_button" />
|
||||
|
||||
</LinearLayout>
|
@ -1,28 +0,0 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerPadding="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle">
|
||||
|
||||
<include layout="@layout/actionbar_include_cancel_button" />
|
||||
|
||||
<include layout="@layout/actionbar_include_done_button" />
|
||||
|
||||
</LinearLayout>
|
@ -17,7 +17,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@drawable/ic_action_expand"/>
|
||||
android:src="@drawable/ic_expand_more_black_24dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/foldableText"
|
||||
|
10
OpenKeychain/src/main/res/layout/full_screen_dialog.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerPadding="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle">
|
||||
|
||||
<include layout="@layout/full_screen_dialog_done_button" />
|
||||
|
||||
</LinearLayout>
|
12
OpenKeychain/src/main/res/layout/full_screen_dialog_2.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerPadding="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle">
|
||||
|
||||
<include layout="@layout/full_screen_dialog_2_cancel_button" />
|
||||
|
||||
<include layout="@layout/full_screen_dialog_2_done_button" />
|
||||
|
||||
</LinearLayout>
|
@ -1,19 +1,3 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/actionbar_cancel"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
@ -30,12 +14,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@drawable/ic_action_cancel"
|
||||
android:drawableLeft="@drawable/ic_close_white_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="20dp"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
style="@style/Widget.AppCompat.Light.ActionBar.TabText"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="14sp"
|
||||
android:text="Cancel (set in-code!)" />
|
||||
|
||||
</FrameLayout>
|
@ -1,19 +1,3 @@
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/actionbar_done"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
@ -30,12 +14,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@drawable/ic_action_done"
|
||||
android:drawableLeft="@drawable/ic_check_white_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="20dp"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
style="@style/Widget.AppCompat.Light.ActionBar.TabText"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="14sp"
|
||||
android:text="Done (set in-code!)" />
|
||||
|
||||
</FrameLayout>
|
@ -0,0 +1,25 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/full_screen_dialog_done"
|
||||
style="@style/Widget.AppCompat.ActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!--
|
||||
android:filterTouchesWhenObscured="true" to prevent Touch-Event Hijacking
|
||||
https://blog.lookout.com/blog/2010/12/09/android-touch-event-hijacking/
|
||||
-->
|
||||
<TextView
|
||||
android:id="@+id/full_screen_dialog_done_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
style="@style/Widget.AppCompat.Light.ActionBar.TabText"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="14sp"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
android:text="Done (set in-code!)" />
|
||||
|
||||
</FrameLayout>
|
10
OpenKeychain/src/main/res/layout/full_screen_dialog_old.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:dividerPadding="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="end" >
|
||||
|
||||
<include layout="@layout/full_screen_dialog_2_done_button" />
|
||||
|
||||
</LinearLayout>
|
@ -20,7 +20,7 @@
|
||||
<string name="title_preferences">"Settings"</string>
|
||||
<string name="title_cloud_search_preferences">"Cloud Search Preferences"</string>
|
||||
<string name="title_api_registered_apps">"Apps"</string>
|
||||
<string name="title_key_server_preference">"Keyserver Preference"</string>
|
||||
<string name="title_key_server_preference">"Keyservers"</string>
|
||||
<string name="title_change_passphrase">"Change Passphrase"</string>
|
||||
<string name="title_share_fingerprint_with">"Share fingerprint with…"</string>
|
||||
<string name="title_share_key">"Share key with…"</string>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<!-- Background for the actions section (e.g. voice, submit) -->
|
||||
<!--<item name="submitBackground">...</item>-->
|
||||
<!-- Close button icon -->
|
||||
<!--<item name="closeIcon">...</item>-->
|
||||
<item name="closeIcon">@drawable/ic_close_white_24dp</item>
|
||||
<!-- Search button icon -->
|
||||
<!--<item name="searchIcon">...</item>-->
|
||||
<!-- Go/commit button icon -->
|
||||
|