Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bug fixes.

this is the real 0.2.5 version :D
  • Loading branch information...
commit b674ebdc4e8dea58e5729c7bad83225947929c13 1 parent 65aee9d
@mariotaku authored
View
4 AndroidManifest.xml
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mariotaku.twidere"
android:installLocation="auto"
- android:versionCode="54"
+ android:versionCode="56"
android:versionName="@string/app_version">
<uses-sdk
@@ -469,7 +469,7 @@
<activity
android:name=".activity.RequestPermissionsActivity"
android:label="@string/permissions_request"
- android:theme="@style/Theme.Blank.DialogWhenLarge">
+ android:theme="@style/Theme.Twidere.Light.Dialog">
<intent-filter>
<action android:name="org.mariotaku.twidere.REQUEST_PERMISSIONS"/>
View
BIN  art/twidere icon_512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  dist/Twidere 0.2.5.apk
Binary file not shown
View
6 res/layout-ar/status_list_item.xml
@@ -88,6 +88,7 @@
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/text"
android:layout_marginTop="8dp"
+ android:layout_toLeftOf="@+id/profile_image"
android:background="?imagePreviewBackground">
<org.mariotaku.twidere.view.ImagePreviewView
@@ -120,7 +121,6 @@
android:text="@string/tap_to_load_more"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#606060"
- android:textStyle="bold"
- android:visibility="gone"/>
+ android:textStyle="bold"/>
-</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
+</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
View
6 res/layout/request_permissions.xml
@@ -9,7 +9,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
- android:padding="16dp">
+ android:padding="8dp">
<ImageView
android:id="@android:id/icon"
@@ -49,7 +49,9 @@
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="16dp"
+ android:paddingBottom="16dp"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<View
View
3  res/layout/status_list_item.xml
@@ -82,6 +82,7 @@
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/text"
android:layout_marginTop="8dp"
+ android:layout_toRightOf="@+id/profile_image"
android:background="?imagePreviewBackground">
<org.mariotaku.twidere.view.ImagePreviewView
@@ -115,4 +116,4 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"/>
-</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
+</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
View
2  res/values/strings_donttranslate.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_version">0.2.5</string>
+ <string name="app_version">0.2.5.1</string>
</resources>
View
88 src/org/mariotaku/twidere/activity/EditUserProfileActivity.java
@@ -1,6 +1,7 @@
package org.mariotaku.twidere.activity;
import static org.mariotaku.twidere.util.Utils.isMyAccount;
+import static org.mariotaku.twidere.util.Utils.parseString;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.app.TwidereApplication;
@@ -8,10 +9,18 @@
import org.mariotaku.twidere.loader.UserBannerImageLoader;
import org.mariotaku.twidere.model.ParcelableUser;
import org.mariotaku.twidere.model.SingleResponse;
+import org.mariotaku.twidere.util.AsyncTask;
+import org.mariotaku.twidere.util.AsyncTaskManager;
+import org.mariotaku.twidere.util.AsyncTwitterWrapper.UpdateProfileTask;
import org.mariotaku.twidere.util.LazyImageLoader;
import org.mariotaku.twidere.view.ProfileNameBannerContainer;
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
+import twitter4j.User;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
@@ -23,6 +32,7 @@
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
@@ -41,13 +51,29 @@
private boolean mBackPressed;
private long mAccountId;
- protected int mBannerWidth;
- protected ParcelableUser mUser;
+ private int mBannerWidth;
+ private ParcelableUser mUser;
private boolean mBannerImageLoaderInitialized;
private final Handler mHandler = new Handler();
+ private UpdateUserProfileTask mTask;
+
+ private final BroadcastReceiver mStatusReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(final Context context, final Intent intent) {
+ if (mUser == null) return;
+ final String action = intent.getAction();
+ if (BROADCAST_PROFILE_UPDATED.equals(action)) {
+ if (mUser == null || intent.getLongExtra(INTENT_KEY_USER_ID, -1) == mUser.user_id) {
+ getSupportLoaderManager().restartLoader(LOADER_ID_USER, null, mUserInfoLoaderCallbacks);
+ }
+ }
+ }
+ };
+
private final LoaderCallbacks<Bitmap> mBannerImageCallback = new LoaderCallbacks<Bitmap>() {
@Override
@@ -75,7 +101,7 @@ public void onLoadFinished(final Loader<Bitmap> loader, final Bitmap data) {
public Loader<SingleResponse<ParcelableUser>> onCreateLoader(final int id, final Bundle args) {
mProgress.setVisibility(View.VISIBLE);
mContent.setVisibility(View.GONE);
- setProgressBarIndeterminateVisibility(true);
+ setSupportProgressBarIndeterminateVisibility(true);
return new ParcelableUserLoader(EditUserProfileActivity.this, mAccountId, mAccountId, null, getIntent()
.getExtras(), false, false);
}
@@ -102,7 +128,7 @@ public void onLoadFinished(final Loader<SingleResponse<ParcelableUser>> loader,
} else {
finish();
}
- setProgressBarIndeterminateVisibility(false);
+ setSupportProgressBarIndeterminateVisibility(false);
}
};
@@ -145,6 +171,7 @@ public void onContentChanged() {
@Override
public void onCreate(final Bundle savedInstanceState) {
+ requestSupportWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
final Bundle extras = getIntent().getExtras();
if (extras == null || !isMyAccount(this, extras.getLong(INTENT_KEY_ACCOUNT_ID))) {
@@ -177,7 +204,13 @@ public boolean onOptionsItemSelected(final MenuItem item) {
break;
}
case MENU_SAVE: {
- finish();
+ final AsyncTaskManager manager = TwidereApplication.getInstance(this).getAsyncTaskManager();
+ final String name = parseString(mEditName.getText());
+ final String url = parseString(mEditUrl.getText());
+ final String location = parseString(mEditLocation.getText());
+ final String description = parseString(mEditDescription.getText());
+ mTask = new UpdateUserProfileTask(this, manager, mAccountId, name, url, location, description);
+ mTask.execute();
return true;
}
}
@@ -188,7 +221,7 @@ public boolean onOptionsItemSelected(final MenuItem item) {
public boolean onPrepareOptionsMenu(final Menu menu) {
final MenuItem save = menu.findItem(MENU_SAVE);
if (save != null) {
- save.setEnabled(mHasUnsavedChanges());
+ save.setEnabled(mHasUnsavedChanges() && (mTask == null || mTask.getStatus() != AsyncTask.Status.RUNNING));
}
return super.onPrepareOptionsMenu(menu);
}
@@ -198,6 +231,19 @@ public void onSizeChanged(final View view, final int w, final int h, final int o
}
@Override
+ public void onStart() {
+ super.onStart();
+ final IntentFilter filter = new IntentFilter(BROADCAST_PROFILE_UPDATED);
+ registerReceiver(mStatusReceiver, filter);
+ }
+
+ @Override
+ public void onStop() {
+ unregisterReceiver(mStatusReceiver);
+ super.onStop();
+ }
+
+ @Override
public void onTextChanged(final CharSequence s, final int length, final int start, final int end) {
invalidateSupportOptionsMenu();
}
@@ -226,6 +272,15 @@ private void getBannerImage() {
}
}
+ private void setUpdateState(final boolean start) {
+ setSupportProgressBarIndeterminateVisibility(start);
+ mEditName.setEnabled(!start);
+ mEditDescription.setEnabled(!start);
+ mEditLocation.setEnabled(!start);
+ mEditUrl.setEnabled(!start);
+ invalidateOptionsMenu();
+ }
+
boolean mHasUnsavedChanges() {
if (mUser == null) return false;
return !stringEquals(mEditName.getText(), mUser.name)
@@ -239,4 +294,25 @@ private static boolean stringEquals(final CharSequence str1, final CharSequence
return str1.toString().equals(str2.toString());
}
+ class UpdateUserProfileTask extends UpdateProfileTask {
+
+ public UpdateUserProfileTask(final Context context, final AsyncTaskManager manager, final long account_id,
+ final String name, final String url, final String location, final String description) {
+ super(context, manager, account_id, name, url, location, description);
+ }
+
+ @Override
+ protected void onPostExecute(final SingleResponse<User> result) {
+ super.onPostExecute(result);
+ setUpdateState(false);
+ }
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ setUpdateState(true);
+ }
+
+ }
+
}
View
2  src/org/mariotaku/twidere/activity/RequestPermissionsActivity.java
@@ -16,7 +16,7 @@
import android.widget.ImageView;
import android.widget.TextView;
-public class RequestPermissionsActivity extends BaseDialogWhenLargeActivity implements OnClickListener {
+public class RequestPermissionsActivity extends BaseDialogActivity implements OnClickListener {
private PermissionsManager mPermissionsManager;
View
4 src/org/mariotaku/twidere/loader/ParcelableUserLoader.java
@@ -78,7 +78,9 @@ public ParcelableUserLoader(final Context context, final long account_id, final
} else
return new SingleResponse<ParcelableUser>(null, null);
final ContentValues values = makeCachedUserContentValues(user, hires_profile_image);
- resolver.delete(CachedUsers.CONTENT_URI, CachedUsers.USER_ID + " = " + user.getId(), null);
+ final String where = CachedUsers.USER_ID + " = " + user.getId() + " OR " + CachedUsers.SCREEN_NAME
+ + " = '" + user.getScreenName() + "'";
+ resolver.delete(CachedUsers.CONTENT_URI, where, null);
resolver.insert(CachedUsers.CONTENT_URI, values);
return new SingleResponse<ParcelableUser>(new ParcelableUser(user, account_id, hires_profile_image), null);
} catch (final TwitterException e) {
View
12 src/org/mariotaku/twidere/util/AsyncTwitterWrapper.java
@@ -380,17 +380,7 @@ public UpdateProfileTask(final Context context, final AsyncTaskManager manager,
@Override
protected SingleResponse<User> doInBackground(final Void... params) {
-
- final Twitter twitter = getTwitterInstance(context, account_id, false);
- if (twitter != null) {
- try {
- final User user = twitter.updateProfile(name, url, location, description);
- return new TwitterSingleResponse<User>(account_id, user, null);
- } catch (final TwitterException e) {
- return new TwitterSingleResponse<User>(account_id, null, e);
- }
- }
- return new TwitterSingleResponse<User>(account_id, null, null);
+ return updateProfile(context, account_id, name, url, location, description);
}
@Override
View
16 src/org/mariotaku/twidere/util/TwitterWrapper.java
@@ -18,6 +18,20 @@
public class TwitterWrapper implements Constants {
+ public static TwitterSingleResponse<User> updateProfile(final Context context, final long account_id,
+ final String name, final String url, final String location, final String description) {
+ final Twitter twitter = getTwitterInstance(context, account_id, false);
+ if (twitter != null) {
+ try {
+ final User user = twitter.updateProfile(name, url, location, description);
+ return new TwitterSingleResponse<User>(account_id, user, null);
+ } catch (final TwitterException e) {
+ return new TwitterSingleResponse<User>(account_id, null, e);
+ }
+ }
+ return new TwitterSingleResponse<User>(account_id, null, null);
+ }
+
public static TwitterSingleResponse<Integer> updateProfileBannerImage(final Context context, final long account_id,
final Uri image_uri, final boolean delete_image) {
final Twitter twitter = getTwitterInstance(context, account_id, false);
@@ -43,7 +57,7 @@
return new TwitterSingleResponse<Integer>(account_id, null, null);
}
- public static SingleResponse<User> updateProfileImage(final Context context, final long account_id,
+ public static TwitterSingleResponse<User> updateProfileImage(final Context context, final long account_id,
final Uri image_uri, final boolean delete_image) {
final Twitter twitter = getTwitterInstance(context, account_id, false);
if (twitter != null && image_uri != null && "file".equals(image_uri.getScheme())) {
Please sign in to comment.
Something went wrong with that request. Please try again.