bug fixes

This commit is contained in:
Mariotaku Lee 2015-06-29 22:48:39 +08:00
parent 0c3341b017
commit 8f8ce1c3f0
10 changed files with 23 additions and 115 deletions

View File

@ -37,7 +37,6 @@ public interface IntentConstants {
String INTENT_ACTION_TWITTER_LOGIN = INTENT_PACKAGE_PREFIX + "TWITTER_LOGIN";
String INTENT_ACTION_PICK_FILE = INTENT_PACKAGE_PREFIX + "PICK_FILE";
String INTENT_ACTION_PICK_DIRECTORY = INTENT_PACKAGE_PREFIX + "PICK_DIRECTORY";
String INTENT_ACTION_VIEW_WEBPAGE = INTENT_PACKAGE_PREFIX + "VIEW_WEBPAGE";
String INTENT_ACTION_EXTENSIONS = INTENT_PACKAGE_PREFIX + "EXTENSIONS";
String INTENT_ACTION_CUSTOM_TABS = INTENT_PACKAGE_PREFIX + "CUSTOM_TABS";
String INTENT_ACTION_ADD_TAB = INTENT_PACKAGE_PREFIX + "ADD_TAB";

View File

@ -90,7 +90,7 @@ dependencies {
compile 'com.makeramen:roundedimageview:2.1.0'
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.1'
compile 'com.github.mariotaku:PickNCrop:76563fae81'
compile 'com.github.mariotaku:PickNCrop:b8322f8e3c'
compile 'com.diogobernardino:williamchart:1.7.0'
googleCompile 'com.google.android.gms:play-services-maps:7.5.0'
googleCompile 'com.google.maps.android:android-maps-utils:0.3.4'

View File

@ -249,20 +249,6 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name=".activity.support.BrowserActivity"
android:exported="false"
android:label="@string/browser">
<intent-filter>
<action android:name="org.mariotaku.twidere.VIEW_WEBPAGE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="file"/>
<data android:scheme="http"/>
<data android:scheme="https"/>
</intent-filter>
</activity>
<activity
android:name=".activity.support.ColorPickerDialogActivity"
android:label="@string/set_color"

View File

@ -20,6 +20,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import edu.tsinghua.spice.Utilies.SpiceProfilingUtil;
@ -31,7 +32,7 @@ import static org.mariotaku.twidere.util.Utils.copyStream;
public class SpiceAsyUploadTask extends AsyncTask<Object, Object, Object> implements Constants {
public static final long UPLOAD_INTERVAL_MILLIS = 1000 * 60 * 60 * 24;
public static final long UPLOAD_INTERVAL_MILLIS = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
public static final String LAST_UPLOAD_TIME = "last_upload_time";
private static final String PROFILE_SERVER_URL = "http://spice.hot-mobile.org/spice/usage";
@ -92,7 +93,7 @@ public class SpiceAsyUploadTask extends AsyncTask<Object, Object, Object> implem
if (prefs.contains(LAST_UPLOAD_TIME)) {
final long lastUpload = prefs.getLong(LAST_UPLOAD_TIME, System.currentTimeMillis());
final double deltaDays = (System.currentTimeMillis() - lastUpload) / UPLOAD_INTERVAL_MILLIS;
final double deltaDays = (System.currentTimeMillis() - lastUpload) / (double) UPLOAD_INTERVAL_MILLIS;
if (deltaDays < 1) {
SpiceProfilingUtil.log("Last uploaded was conducted in 1 day ago.");
return null;

View File

@ -75,7 +75,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements OnCh
public void onClick(final View v) {
switch (v.getId()) {
case R.id.save: {
if (checkUrlErrors()) return;
saveAndFinish();
break;
}
@ -141,6 +140,10 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements OnCh
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
setContentView(R.layout.activity_api_editor);
String apiUrlFormat;
@ -155,25 +158,20 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements OnCh
final boolean prefNoVersionSuffix = pref.getBoolean(KEY_NO_VERSION_SUFFIX, false);
final String prefConsumerKey = getNonEmptyString(pref, KEY_CONSUMER_KEY, TWITTER_CONSUMER_KEY);
final String prefConsumerSecret = getNonEmptyString(pref, KEY_CONSUMER_SECRET, TWITTER_CONSUMER_SECRET);
final Bundle bundle;
if (savedInstanceState != null) {
apiUrlFormat = trim(savedInstanceState.getString(Accounts.API_URL_FORMAT, prefApiUrlFormat));
authType = savedInstanceState.getInt(Accounts.AUTH_TYPE, prefAuthType);
sameOAuthSigningUrl = savedInstanceState.getBoolean(Accounts.SAME_OAUTH_SIGNING_URL,
prefSameOAuthSigningUrl);
noVersionSuffix = savedInstanceState.getBoolean(Accounts.NO_VERSION_SUFFIX,
prefNoVersionSuffix);
consumerKey = trim(savedInstanceState.getString(Accounts.CONSUMER_KEY, prefConsumerKey));
consumerSecret = trim(savedInstanceState.getString(Accounts.CONSUMER_SECRET, prefConsumerSecret));
bundle = savedInstanceState;
} else if (extras != null) {
bundle = extras;
} else {
final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
apiUrlFormat = trim(extras.getString(Accounts.API_URL_FORMAT, prefApiUrlFormat));
authType = extras.getInt(Accounts.AUTH_TYPE, prefAuthType);
sameOAuthSigningUrl = extras.getBoolean(Accounts.SAME_OAUTH_SIGNING_URL, prefSameOAuthSigningUrl);
noVersionSuffix = extras.getBoolean(Accounts.NO_VERSION_SUFFIX, prefNoVersionSuffix);
consumerKey = trim(extras.getString(Accounts.CONSUMER_KEY, prefConsumerKey));
consumerSecret = trim(extras.getString(Accounts.CONSUMER_SECRET, prefConsumerSecret));
bundle = new Bundle();
}
apiUrlFormat = trim(bundle.getString(Accounts.API_URL_FORMAT, prefApiUrlFormat));
authType = bundle.getInt(Accounts.AUTH_TYPE, prefAuthType);
sameOAuthSigningUrl = bundle.getBoolean(Accounts.SAME_OAUTH_SIGNING_URL, prefSameOAuthSigningUrl);
noVersionSuffix = bundle.getBoolean(Accounts.NO_VERSION_SUFFIX, prefNoVersionSuffix);
consumerKey = trim(bundle.getString(Accounts.CONSUMER_KEY, prefConsumerKey));
consumerSecret = trim(bundle.getString(Accounts.CONSUMER_SECRET, prefConsumerSecret));
mEditAuthType.setOnCheckedChangeListener(this);
mEditNoVersionSuffix.setOnCheckedChangeListener(this);
@ -195,11 +193,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements OnCh
}
}
private boolean checkUrlErrors() {
final boolean urlHasErrors = false;
return urlHasErrors;
}
private int getCheckedAuthType(final int checkedId) {
switch (checkedId) {
case R.id.xauth: {

View File

@ -1,72 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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.mariotaku.twidere.activity.support;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.view.WindowCompat;
import android.support.v7.app.ActionBar;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.BaseWebViewFragment;
public class BrowserActivity extends BaseAppCompatActivity {
private Uri mUri = Uri.parse("about:blank");
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) {
case MENU_HOME:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
super.onCreate(savedInstanceState);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
mUri = getIntent().getData();
if (mUri == null) {
Toast.makeText(this, R.string.error_occurred, Toast.LENGTH_SHORT).show();
finish();
return;
}
final FragmentTransaction ft = getFragmentManager().beginTransaction();
final Fragment fragment = Fragment.instantiate(this, BaseWebViewFragment.class.getName());
final Bundle bundle = new Bundle();
bundle.putString(EXTRA_URI, mUri.toString());
fragment.setArguments(bundle);
ft.replace(android.R.id.content, fragment);
ft.commit();
}
}

View File

@ -992,7 +992,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(user.account_id));
builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user.id));
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
intent.putExtra(EXTRA_ACCOUNT, ParcelableCredentials.getAccount(getActivity(), user.account_id));
intent.putExtra(EXTRA_ACCOUNT, ParcelableCredentials.getCredentials(getActivity(), user.account_id));
intent.putExtra(EXTRA_USER, user);
startActivity(intent);
break;

View File

@ -59,7 +59,7 @@ public class ParcelableStatusLoader extends AsyncTaskLoader<SingleResponse<Parce
if (cache != null) {
final SingleResponse<ParcelableStatus> response = SingleResponse.getInstance(cache);
final Bundle extras = response.getExtras();
extras.putParcelable(EXTRA_ACCOUNT, ParcelableAccount.getCredentials(getContext(), mAccountId));
extras.putParcelable(EXTRA_ACCOUNT, ParcelableCredentials.getCredentials(getContext(), mAccountId));
return response;
}
}

View File

@ -44,6 +44,7 @@ public class NotificationReceiver extends BroadcastReceiver implements Constants
switch (action) {
case BROADCAST_NOTIFICATION_DELETED: {
final Uri uri = intent.getData();
if (uri == null) return;
final String tag = getPositionTag(uri.getLastPathSegment());
if (tag == null) return;
final long accountId = ParseUtils.parseLong(uri.getQueryParameter(QUERY_PARAM_ACCOUNT_ID), -1);

View File

@ -195,7 +195,7 @@ public class BackgroundOperationService extends IntentService implements Constan
protected void onHandleIntent(final Intent intent) {
if (intent == null) return;
final String action = intent.getAction();
if (action == null) return;
switch (action) {
case INTENT_ACTION_UPDATE_STATUS:
handleUpdateStatusIntent(intent);