changed single_account config into more simple lock_settings
This commit is contained in:
parent
c393e60891
commit
60ab03afb1
|
@ -45,7 +45,7 @@ public final class Config {
|
||||||
public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain
|
public static final String CONFERENCE_DOMAIN_LOCK = null; //only allow conference creation for this domain
|
||||||
public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains
|
public static final boolean LOCK_DOMAINS_IN_CONVERSATIONS = false; //only add contacts and conferences for own domains
|
||||||
|
|
||||||
public static final boolean SINGLE_ACCOUNT = false; //set to true to allow only one account
|
public static final boolean LOCK_SETTINGS = false; //set to true to disallow account and settings editing
|
||||||
public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox
|
public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox
|
||||||
|
|
||||||
public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true
|
public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.muc_details, menu);
|
getMenuInflater().inflate(R.menu.muc_details, menu);
|
||||||
return true;
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -297,7 +297,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
edit.setVisible(false);
|
edit.setVisible(false);
|
||||||
delete.setVisible(false);
|
delete.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateView() {
|
private void populateView() {
|
||||||
|
|
|
@ -420,7 +420,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void selectPresenceToAttachFile(final int attachmentChoice, final int encryption) {
|
protected void selectPresenceToAttachFile(final int attachmentChoice, final int encryption) {
|
||||||
|
|
|
@ -499,7 +499,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
clearDevices.setVisible(false);
|
clearDevices.setVisible(false);
|
||||||
mamPrefs.setVisible(false);
|
mamPrefs.setVisible(false);
|
||||||
}
|
}
|
||||||
return true;
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -621,6 +621,13 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
|
||||||
this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
|
this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
mPassword.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
mAccountJid.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
mHostname.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
mPort.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
mPasswordConfirm.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
mRegisterNew.setEnabled(!Config.LOCK_SETTINGS);
|
||||||
|
|
||||||
if (!mInitMode) {
|
if (!mInitMode) {
|
||||||
this.mAvatar.setVisibility(View.VISIBLE);
|
this.mAvatar.setVisibility(View.VISIBLE);
|
||||||
this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(72)));
|
this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(72)));
|
||||||
|
|
|
@ -155,9 +155,9 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
||||||
addAccount.setVisible(false);
|
addAccount.setVisible(false);
|
||||||
addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
addAccountWithCertificate.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
} else {
|
} else {
|
||||||
addAccount.setVisible(!Config.SINGLE_ACCOUNT);
|
addAccount.setVisible(!Config.LOCK_SETTINGS);
|
||||||
}
|
}
|
||||||
addAccountWithCertificate.setVisible(!Config.SINGLE_ACCOUNT);
|
addAccountWithCertificate.setVisible(!Config.LOCK_SETTINGS);
|
||||||
|
|
||||||
if (!accountsLeftToEnable()) {
|
if (!accountsLeftToEnable()) {
|
||||||
enableAll.setVisible(false);
|
enableAll.setVisible(false);
|
||||||
|
|
|
@ -533,7 +533,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
mSearchEditText.append(mInitialJid);
|
mSearchEditText.append(mInitialJid);
|
||||||
filter(mInitialJid);
|
filter(mInitialJid);
|
||||||
}
|
}
|
||||||
return true;
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,6 +42,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
@ -377,6 +378,19 @@ public abstract class XmppActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
final MenuItem menuSettings = menu.findItem(R.id.action_settings);
|
||||||
|
final MenuItem menuManageAccounts = menu.findItem(R.id.action_accounts);
|
||||||
|
if (menuSettings != null) {
|
||||||
|
menuSettings.setVisible(!Config.LOCK_SETTINGS);
|
||||||
|
}
|
||||||
|
if (menuManageAccounts != null) {
|
||||||
|
menuManageAccounts.setVisible(!Config.LOCK_SETTINGS);
|
||||||
|
}
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean showBatteryOptimizationWarning() {
|
protected boolean showBatteryOptimizationWarning() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
|
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
|
||||||
|
|
Loading…
Reference in a new issue