updated library version

disabled acra reporting
fixed 'open with account' not working issue
This commit is contained in:
Mariotaku Lee 2014-12-02 00:29:34 +08:00
parent fd8e90aa65
commit 0abbe2a2d8
7 changed files with 263 additions and 256 deletions

View File

@ -79,21 +79,19 @@ android {
dependencies {
// wearApp project(':twidere.wear')
compile 'com.android.support:support-v13:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:palette-v7:21.0.0'
compile 'com.android.support:support-v13:21.0.2'
compile 'com.android.support:cardview-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:palette-v7:21.0.2'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.sothree.slidinguppanel:library:2.0.0'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
compile 'com.twitter:twitter-text:1.9.9'
compile 'com.twitter:twitter-text:1.10.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
compile 'ch.acra:acra:4.5.0'
compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
compile 'me.grantland:autofittextview:0.2.0'
compile 'com.github.johnpersano:supertoasts:1.3.4.1@aar'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
googleCompile 'com.google.android.gms:play-services:6.1.71'
fdroidCompile 'org.osmdroid:osmdroid-android:4.2'

View File

@ -41,149 +41,149 @@ import org.mariotaku.twidere.provider.TweetStore.Accounts;
import org.mariotaku.twidere.util.ArrayUtils;
public class AccountSelectorActivity extends BaseSupportDialogActivity implements LoaderCallbacks<Cursor>,
OnClickListener, OnItemClickListener {
OnClickListener, OnItemClickListener {
private final ContentObserver mContentObserver = new ContentObserver(null) {
private final ContentObserver mContentObserver = new ContentObserver(null) {
@Override
public void onChange(final boolean selfChange) {
onChange(selfChange, null);
}
@Override
public void onChange(final boolean selfChange) {
onChange(selfChange, null);
}
@Override
public void onChange(final boolean selfChange, final Uri uri) {
// Handle change.
if (!isFinishing()) {
getLoaderManager().restartLoader(0, null, AccountSelectorActivity.this);
}
}
};
@Override
public void onChange(final boolean selfChange, final Uri uri) {
// Handle change.
if (!isFinishing()) {
getLoaderManager().restartLoader(0, null, AccountSelectorActivity.this);
}
}
};
private SharedPreferences mPreferences;
private SharedPreferences mPreferences;
private ListView mListView;
private AccountsAdapter mAdapter;
private ListView mListView;
private AccountsAdapter mAdapter;
private boolean mFirstCreated;
private boolean mFirstCreated;
private View mSelectAccountDivider;
private View mSelectAccountDivider;
private View mSelectAccountButtons;
private View mSelectAccountButtons;
@Override
public void onClick(final View view) {
switch (view.getId()) {
case R.id.save: {
final long[] checkedIds = mListView.getCheckedItemIds();
if (checkedIds == null || checkedIds.length == 0 && !isSelectNoneAllowed()) {
Toast.makeText(this, R.string.no_account_selected, Toast.LENGTH_SHORT).show();
return;
}
final Intent data = new Intent();
data.putExtra(EXTRA_IDS, checkedIds);
setResult(RESULT_OK, data);
finish();
break;
}
}
}
@Override
public void onClick(final View view) {
switch (view.getId()) {
case R.id.save: {
final long[] checkedIds = mListView.getCheckedItemIds();
if (checkedIds.length == 0 && !isSelectNoneAllowed()) {
Toast.makeText(this, R.string.no_account_selected, Toast.LENGTH_SHORT).show();
return;
}
final Intent data = new Intent();
data.putExtra(EXTRA_IDS, checkedIds);
setResult(RESULT_OK, data);
finish();
break;
}
}
}
@Override
public void onContentChanged() {
super.onContentChanged();
mListView = (ListView) findViewById(android.R.id.list);
mSelectAccountDivider = findViewById(R.id.select_account_divider);
mSelectAccountButtons = findViewById(R.id.select_account_buttons);
}
@Override
public void onContentChanged() {
super.onContentChanged();
mListView = (ListView) findViewById(android.R.id.list);
mSelectAccountDivider = findViewById(R.id.select_account_divider);
mSelectAccountButtons = findViewById(R.id.select_account_buttons);
}
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
final String where = isOAuthOnly() ? Accounts.AUTH_TYPE + " = " + Accounts.AUTH_TYPE_OAUTH : null;
return new CursorLoader(this, Accounts.CONTENT_URI, Accounts.COLUMNS, where, null, null);
}
@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
final String where = isOAuthOnly() ? Accounts.AUTH_TYPE + " = " + Accounts.AUTH_TYPE_OAUTH : null;
return new CursorLoader(this, Accounts.CONTENT_URI, Accounts.COLUMNS, where, null, null);
}
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
final Intent data = new Intent();
data.putExtra(EXTRA_ID, id);
setResult(RESULT_OK, data);
finish();
}
@Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) {
mAdapter.swapCursor(cursor);
if (cursor != null && mFirstCreated) {
final long[] activatedIds = getIntentExtraIds();
for (int i = 0, j = mAdapter.getCount(); i < j; i++) {
mListView.setItemChecked(i, ArrayUtils.contains(activatedIds, mAdapter.getItemId(i)));
}
}
}
@Override
public void onLoaderReset(final Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
@Override
public void onLoaderReset(final Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
@Override
public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) {
mAdapter.swapCursor(cursor);
if (cursor != null && mFirstCreated) {
final long[] activatedIds = getIntentExtraIds();
for (int i = 0, j = mAdapter.getCount(); i < j; i++) {
mListView.setItemChecked(i, ArrayUtils.contains(activatedIds, mAdapter.getItemId(i)));
}
}
}
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
final Intent data = new Intent();
data.putExtra(EXTRA_ID, mAdapter.getAccount(position).account_id);
setResult(RESULT_OK, data);
finish();
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFirstCreated = savedInstanceState == null;
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
setContentView(R.layout.activity_account_selector);
mAdapter = new AccountsAdapter(this);
final boolean isSingleSelection = isSingleSelection();
mListView.setChoiceMode(isSingleSelection ? ListView.CHOICE_MODE_NONE : ListView.CHOICE_MODE_MULTIPLE);
mAdapter.setChoiceMode(mListView.getChoiceMode());
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFirstCreated = savedInstanceState == null;
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
setContentView(R.layout.activity_account_selector);
mAdapter = new AccountsAdapter(this);
final boolean isSingleSelection = isSingleSelection();
mListView.setChoiceMode(isSingleSelection ? ListView.CHOICE_MODE_NONE : ListView.CHOICE_MODE_MULTIPLE);
mAdapter.setChoiceMode(mListView.getChoiceMode());
mAdapter.setSortEnabled(false);
if (isSingleSelection) {
mListView.setOnItemClickListener(this);
}
mSelectAccountDivider.setVisibility(isSingleSelection ? View.GONE : View.VISIBLE);
mSelectAccountButtons.setVisibility(isSingleSelection ? View.GONE : View.VISIBLE);
mListView.setAdapter(mAdapter);
getLoaderManager().initLoader(0, null, this);
if (isSingleSelection) {
mListView.setOnItemClickListener(this);
}
mSelectAccountDivider.setVisibility(isSingleSelection ? View.GONE : View.VISIBLE);
mSelectAccountButtons.setVisibility(isSingleSelection ? View.GONE : View.VISIBLE);
mListView.setAdapter(mAdapter);
getLoaderManager().initLoader(0, null, this);
}
}
@Override
protected void onResume() {
super.onResume();
final boolean display_profile_image = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
mAdapter.setDisplayProfileImage(display_profile_image);
}
@Override
protected void onStart() {
super.onStart();
getContentResolver().registerContentObserver(Accounts.CONTENT_URI, true, mContentObserver);
}
@Override
protected void onStart() {
super.onStart();
getContentResolver().registerContentObserver(Accounts.CONTENT_URI, true, mContentObserver);
}
@Override
protected void onResume() {
super.onResume();
final boolean display_profile_image = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
mAdapter.setDisplayProfileImage(display_profile_image);
}
@Override
protected void onStop() {
getContentResolver().unregisterContentObserver(mContentObserver);
super.onStop();
}
@Override
protected void onStop() {
getContentResolver().unregisterContentObserver(mContentObserver);
super.onStop();
}
private long[] getIntentExtraIds() {
final Intent intent = getIntent();
return intent.getLongArrayExtra(EXTRA_IDS);
}
private long[] getIntentExtraIds() {
final Intent intent = getIntent();
return intent.getLongArrayExtra(EXTRA_IDS);
}
private boolean isOAuthOnly() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_OAUTH_ONLY, false);
}
private boolean isOAuthOnly() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_OAUTH_ONLY, false);
}
private boolean isSelectNoneAllowed() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_ALLOW_SELECT_NONE, false);
}
private boolean isSelectNoneAllowed() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_ALLOW_SELECT_NONE, false);
}
private boolean isSingleSelection() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_SINGLE_SELECTION, false);
}
private boolean isSingleSelection() {
final Intent intent = getIntent();
return intent.getBooleanExtra(EXTRA_SINGLE_SELECTION, false);
}
}

View File

@ -191,8 +191,8 @@ public class LinkHandlerActivity extends BaseSupportActivity implements OnClickL
mMainContent.setDrawShadow(false);
mMainContent.setDrawColor(!ThemeUtils.isDarkTheme(getCurrentThemeResourceId()));
mMainContent.setFactor(1);
final int color = ThemeUtils.getUserAccentColor(this);
final int alpha = ThemeUtils.getThemeAlpha(this);
final int color = getCurrentThemeColor();
final int alpha = getCurrentThemeBackgroundAlpha();
mMainContent.setColor(color, alpha);
break;
}

View File

@ -248,8 +248,8 @@ public class TwidereApplication extends Application implements Constants, OnShar
}
private void configACRA() {
ACRA.init(this);
ACRA.getErrorReporter().setReportSender(new EmailIntentSender(this));
// ACRA.init(this);
// ACRA.getErrorReporter().setReportSender(new EmailIntentSender(this));
}
private DiskCache createDiskCache(final String dirName) {

View File

@ -57,6 +57,7 @@ import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.graphics.Palette;
import android.support.v7.graphics.Palette.PaletteAsyncListener;
import android.support.v7.widget.CardView;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
@ -155,6 +156,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
public static final String TRANSITION_NAME_PROFILE_IMAGE = "profile_image";
public static final String TRANSITION_NAME_PROFILE_TYPE = "profile_type";
public static final String TRANSITION_NAME_CARD = "card";
private static final int LOADER_ID_USER = 1;
private static final int LOADER_ID_FRIENDSHIP = 2;
@ -178,11 +180,20 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private HeaderDrawerLayout mHeaderDrawerLayout;
private ViewPager mViewPager;
private PagerSlidingTabStrip mPagerIndicator;
private CardView mCardView;
private View mUuckyFooter;
private SupportTabsAdapter mPagerAdapter;
private Relationship mRelationship;
private ParcelableUser mUser = null;
private Locale mLocale;
private boolean mGetUserInfoLoaderInitialized, mGetFriendShipLoaderInitialized;
private int mBannerWidth;
private ActionBarDrawable mActionBarBackground;
private Fragment mCurrentVisibleFragment;
private final BroadcastReceiver mStatusReceiver = new BroadcastReceiver() {
@Override
@ -327,12 +338,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
}
};
private Locale mLocale;
private boolean mGetUserInfoLoaderInitialized, mGetFriendShipLoaderInitialized;
private int mBannerWidth;
private ActionBarDrawable mActionBarBackground;
private Fragment mCurrentVisibleFragment;
private View mUuckyFooter;
public void displayUser(final ParcelableUser user) {
mRelationship = null;
@ -544,7 +549,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
if (resultCode == Activity.RESULT_OK) {
if (data == null || !data.hasExtra(EXTRA_ID)) return;
final long accountId = data.getLongExtra(EXTRA_ID, -1);
openUserProfile(getActivity(), accountId, user.id, null, null);
openUserProfile(getActivity(), accountId, user.id, user.screen_name, null);
}
break;
}
@ -587,6 +592,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
ViewCompat.setTransitionName(mProfileImageView, TRANSITION_NAME_PROFILE_IMAGE);
ViewCompat.setTransitionName(mProfileTypeView, TRANSITION_NAME_PROFILE_TYPE);
ViewCompat.setTransitionName(mCardView, TRANSITION_NAME_CARD);
mHeaderDrawerLayout.setDrawerCallback(this);
@ -809,6 +815,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mProfileBannerView = (ProfileBannerImageView) view.findViewById(R.id.profile_banner);
final View headerView = mHeaderDrawerLayout.getHeader();
final View contentView = mHeaderDrawerLayout.getContent();
mCardView = (CardView) headerView.findViewById(R.id.card);
mNameView = (TextView) headerView.findViewById(R.id.name);
mScreenNameView = (TextView) headerView.findViewById(R.id.screen_name);
mDescriptionView = (TextView) headerView.findViewById(R.id.description);
@ -1297,23 +1304,24 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
return mColor;
}
public void setColor(int color) {
mColor = color;
updatePaint();
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mBounds.set(bounds);
}
public void setColor(int color) {
mColor = color;
updatePaint();
}
private void updatePaint() {
mPaint.setColor(mColor);
mPaint.setAlpha(Color.alpha(mColor) * mAlpha / 0xFF);
invalidateSelf();
}
@Override
public int getAlpha() {
return mAlpha;

View File

@ -1,134 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.ProfileImageBannerLayout
android:id="@+id/profile_image_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<org.mariotaku.twidere.view.ProfileImageBannerLayout
android:id="@+id/profile_image_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<LinearLayout
android:id="@+id/profile_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="8dp">
<org.mariotaku.twidere.view.ColorLabelLinearLayout
android:id="@+id/profile_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="textPersonName"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
</FrameLayout>
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="textPersonName"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</org.mariotaku.twidere.view.ColorLabelLinearLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/description_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<LinearLayout
android:id="@+id/description_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/description"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/description"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:maxLength="160"
android:minLines="4"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
<EditText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="textMultiLine"
android:maxLength="160"
android:minLines="4"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
<LinearLayout
android:id="@+id/location_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<LinearLayout
android:id="@+id/location_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/location"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/location"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"
android:maxLength="30"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
<EditText
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"
android:maxLength="30"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
<LinearLayout
android:id="@+id/url_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<LinearLayout
android:id="@+id/url_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/url"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="@string/url"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText
android:id="@+id/url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:maxLength="100"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<EditText
android:id="@+id/url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:maxLength="100"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</merge>

View File

@ -29,6 +29,7 @@
android:id="@+id/view_pager_tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/element_size_normal"
android:textColor="?android:textColorSecondary"
app:pstsTabBackground="?android:selectableItemBackground"/>
<android.support.v4.view.ViewPager