Commit 8bb32fcf authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'release/0.9.30d'

parents 277806a5 231ef152

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
bin/*
gen/*
*.orig
.pydevproject
.settings
local.properties
*.iml
.idea
build
.gradle
*.apk
app/manifest-merger-release-report.txt
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>xabber</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
This diff is collapsed.
apply plugin: 'com.android.application'
android {
compileSdkVersion 9
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xabber.androiddev"
minSdkVersion 3
targetSdkVersion 9
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/otr4j.jar')
}
This diff is collapsed.
/* -*-mode:java; c-basic-offset:2; -*- */
/*
Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This program is based on zlib-1.1.3, so all credit should go authors
* Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
* and contributors of zlib.
*/
package com.jcraft.jzlib;
public class ZStreamException extends java.io.IOException {
public ZStreamException() {
super();
}
public ZStreamException(String s) {
super(s);
}
}
This diff is collapsed.
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber 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 com.xabber.android.data;
import android.database.sqlite.SQLiteDatabase;
/**
* Interface for registered database tables.
*
* @author alexander.ivanov
*
*/
public interface DatabaseTable {
/**
* Called on create database.
*
* @param db
*/
void create(SQLiteDatabase db);
/**
* Called on database migration.
*
* @param db
* @param toVersion
*/
void migrate(SQLiteDatabase db, int toVersion);
/**
* Called on clear database request.
*/
void clear();
}
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber 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 com.xabber.android.data;
/**
* Listener for database migration.
*
* @author alexander.ivanov
*
*/
public interface OnMigrationListener extends BaseManagerInterface {
/**
* Called on database migration for each intermediate versions.
*
* @param toVersion
*/
void onMigrate(int toVersion);
}
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber 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 com.xabber.android.data.account;
public class SavedStatus implements Comparable<SavedStatus> {
private final StatusMode statusMode;
private final String statusText;
public SavedStatus(StatusMode statusMode, String statusText) {
super();
this.statusMode = statusMode;
this.statusText = statusText;
}
public StatusMode getStatusMode() {
return statusMode;
}
public String getStatusText() {
return statusText;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((statusMode == null) ? 0 : statusMode.hashCode());
result = prime * result
+ ((statusText == null) ? 0 : statusText.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SavedStatus other = (SavedStatus) obj;
if (statusMode != other.statusMode)
return false;
if (statusText == null) {
if (other.statusText != null)
return false;
} else if (!statusText.equals(other.statusText))
return false;
return true;
}
@Override
public int compareTo(SavedStatus another) {
int result = statusMode.compareTo(another.statusMode);
if (result != 0)
return result;
return statusText.compareToIgnoreCase(another.statusText);
}
}
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber 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 com.xabber.android.data.account;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.provider.BaseColumns;
import com.xabber.android.data.AbstractTable;
import com.xabber.android.data.DatabaseManager;
/**
* Storage with preset statuses.
*
* @author alexander.ivanov
*/
class StatusTable extends AbstractTable {
private static final class Fields implements BaseColumns {
private Fields() {
}
public static final String STATUS_MODE = "status_mode";
public static final String STATUS_TEXT = "status_text";
}
private static final String NAME = "statuses";
private static final String[] PROJECTION = new String[] {
Fields.STATUS_MODE, Fields.STATUS_TEXT };
private final DatabaseManager databaseManager;
private SQLiteStatement writeStatement;
private final Object writeLock;
private final static StatusTable instance;
static {
instance = new StatusTable(DatabaseManager.getInstance());
DatabaseManager.getInstance().addTable(instance);
}
public static StatusTable getInstance() {
return instance;
}
private StatusTable(DatabaseManager databaseManager) {
this.databaseManager = databaseManager;
writeStatement = null;
writeLock = new Object();
}
@Override
public void create(SQLiteDatabase db) {
String sql;
sql = "CREATE TABLE " + NAME + " (" + Fields.STATUS_MODE + " INTEGER,"
+ Fields.STATUS_TEXT + " TEXT);";
DatabaseManager.execSQL(db, sql);
sql = "CREATE UNIQUE INDEX " + NAME + "_index ON " + NAME + " ("
+ Fields.STATUS_MODE + ", " + Fields.STATUS_TEXT + ");";
DatabaseManager.execSQL(db, sql);
}
@Override
public void migrate(SQLiteDatabase db, int toVersion) {
super.migrate(db, toVersion);
String sql;
switch (toVersion) {
case 12:
sql = "CREATE TABLE statuses (" + "status_mode INTEGER,"
+ "status_text TEXT);";
DatabaseManager.execSQL(db, sql);
sql = "CREATE UNIQUE INDEX statuses_index ON statuses "
+ "(status_mode, status_text);";
DatabaseManager.execSQL(db, sql);
break;
case 35:
sql = "ALTER TABLE statuses ADD COLUMN share_location INTEGER;";
DatabaseManager.execSQL(db, sql);
sql = "UPDATE statuses SET share_location = 0;";
DatabaseManager.execSQL(db, sql);
sql = "DROP INDEX statuses_index;";
DatabaseManager.execSQL(db, sql);
sql = "CREATE UNIQUE INDEX statuses_index ON statuses "
+ "(status_mode, status_text, share_location);";
DatabaseManager.execSQL(db, sql);
break;
case 38:
sql = "DROP INDEX statuses_index;";
DatabaseManager.execSQL(db, sql);
DatabaseManager.renameTable(db, "statuses", "old_statuses");
sql = "CREATE TABLE statuses (" + "status_mode INTEGER,"
+ "status_text TEXT);";
DatabaseManager.execSQL(db, sql);
sql = "CREATE UNIQUE INDEX statuses_index ON statuses "
+ "(status_mode, status_text);";
DatabaseManager.execSQL(db, sql);
sql = "INSERT OR REPLACE INTO statuses (status_mode, status_text) "
+ "SELECT status_mode, status_text FROM old_statuses;";
DatabaseManager.execSQL(db, sql);
DatabaseManager.dropTable(db, "old_statuses");
break;
default:
break;
}
}
void write(StatusMode statusMode, String statusText) {
if (statusText == null)
statusText = "";
synchronized (writeLock) {
if (writeStatement == null) {
SQLiteDatabase db = databaseManager.getWritableDatabase();
writeStatement = db.compileStatement("INSERT OR REPLACE INTO "
+ NAME + " (" + Fields.STATUS_MODE + ", "
+ Fields.STATUS_TEXT + ") VALUES (?, ?);");
}
writeStatement.bindLong(1, statusMode.ordinal());
writeStatement.bindString(2, statusText);
writeStatement.execute();
}
}
void remove(StatusMode statusMode, String statusText) {
SQLiteDatabase db = databaseManager.getWritableDatabase();
db.delete(NAME, Fields.STATUS_MODE + " = ? AND " + Fields.STATUS_TEXT
+ " = ?", new String[] { String.valueOf(statusMode.ordinal()),
statusText });
}
@Override
protected String getTableName() {
return NAME;
}
@Override
protected String[] getProjection() {
return PROJECTION;
}
static StatusMode getStatusMode(Cursor cursor) {
return StatusMode.values()[cursor.getInt(cursor
.getColumnIndex(Fields.STATUS_MODE))];
}
static String getStatusText(Cursor cursor) {
return cursor.getString(cursor.getColumnIndex(Fields.STATUS_TEXT));
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment