removed unused modules
simplified account manager
6
.gitmodules
vendored
@ -4,12 +4,6 @@
|
||||
[submodule "libraries/DragSortListView"]
|
||||
path = libraries/DragSortListView
|
||||
url = https://github.com/mariotaku/DragSortListView-Gradle
|
||||
[submodule "libraries/RefreshNow"]
|
||||
path = libraries/RefreshNow
|
||||
url = https://github.com/mariotaku/RefreshNow-Android
|
||||
[submodule "libraries/PullToRefresh"]
|
||||
path = libraries/PullToRefresh
|
||||
url = https://github.com/mariotaku/Android-PullToRefresh-Gradle.git
|
||||
[submodule "libraries/MessageBubbleView"]
|
||||
path = libraries/MessageBubbleView
|
||||
url = https://github.com/mariotaku/MessageBubbleView.git
|
||||
|
@ -10,9 +10,9 @@
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
org.gradle.parallel=true
|
@ -1 +0,0 @@
|
||||
Subproject commit 38b56f5c8f692967428af3454ab17e055ea03727
|
@ -1 +0,0 @@
|
||||
Subproject commit f4e2d5afba10ae45528d43dce3629a5db7f2738e
|
@ -12,11 +12,9 @@ include ':twidere.component.nyan'
|
||||
include ':twidere.extension.streaming'
|
||||
include ':twidere.extension.twitlonger'
|
||||
include ':twidere.extension.push.xiaomi'
|
||||
include ':SlidingMenu', ':DragSortListView', ':RefreshNow', ':PullToRefresh', ':MessageBubbleView', ':ColorPicker'
|
||||
include ':SlidingMenu', ':DragSortListView', ':MessageBubbleView', ':ColorPicker'
|
||||
|
||||
project(':SlidingMenu').projectDir = file('libraries/SlidingMenu/library')
|
||||
project(':DragSortListView').projectDir = file('libraries/DragSortListView/library')
|
||||
project(':RefreshNow').projectDir = file('libraries/RefreshNow/library')
|
||||
project(':PullToRefresh').projectDir = file('libraries/PullToRefresh/library')
|
||||
project(':MessageBubbleView').projectDir = file('libraries/MessageBubbleView/library')
|
||||
project(':ColorPicker').projectDir = file('libraries/ColorPicker/library')
|
@ -45,12 +45,15 @@
|
||||
android:label="@string/app_name"/>
|
||||
|
||||
<permission
|
||||
android:description="@string/permission_description_shorten_status"
|
||||
android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
<permission
|
||||
android:description="@string/permission_description_upload_media"
|
||||
android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
<permission
|
||||
android:description="@string/permission_description_sync_timeline"
|
||||
android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
|
||||
|
@ -5,6 +5,8 @@ import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -25,7 +27,7 @@ public class UploadTask extends AsyncTask<Void, Void, Void> {
|
||||
private final String device_id;
|
||||
private final Context context;
|
||||
|
||||
private final HttpClientWrapper client = new HttpClientWrapper();
|
||||
private final HttpClientWrapper client;
|
||||
|
||||
private static final String PROFILE_SERVER_URL = "http://weik.metaisle.com/profiles";
|
||||
|
||||
@ -34,6 +36,7 @@ public class UploadTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
public UploadTask(final Context context) {
|
||||
this.context = context;
|
||||
this.client = Utils.getDefaultHttpClient(context);
|
||||
device_id = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,6 @@ public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Cons
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
private long mDefaultAccountId;
|
||||
|
||||
private boolean mDisplayProfileImage;
|
||||
private int mChoiceMode;
|
||||
private boolean mSortEnabled;
|
||||
@ -70,7 +68,6 @@ public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Cons
|
||||
final AccountViewHolder holder = (AccountViewHolder) view.getTag();
|
||||
holder.screen_name.setText("@" + cursor.getString(mIndices.screen_name));
|
||||
holder.setAccountColor(color);
|
||||
holder.setIsDefault(mDefaultAccountId != -1 && mDefaultAccountId == cursor.getLong(mIndices.account_id));
|
||||
if (mDisplayProfileImage) {
|
||||
mImageLoader.displayProfileImage(holder.profile_image, cursor.getString(mIndices.profile_image_url));
|
||||
} else {
|
||||
@ -127,12 +124,6 @@ public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Cons
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
mDefaultAccountId = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayNameFirst(boolean nameFirst) {
|
||||
|
||||
|
@ -29,6 +29,7 @@ import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
@ -490,6 +491,9 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
|
||||
}
|
||||
|
||||
private void finishAnimation() {
|
||||
final Editor editor = mPreferences.edit();
|
||||
editor.putLong(KEY_DEFAULT_ACCOUNT_ID, account.account_id);
|
||||
editor.apply();
|
||||
mAccountsAdapter.setSelectedAccountId(account.account_id);
|
||||
updateAccountOptionsSeparatorLabel(clickedDrawable);
|
||||
snapshotView.setVisibility(View.INVISIBLE);
|
||||
|
@ -9,7 +9,6 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
@ -98,9 +97,9 @@ public class AccountsManagerFragment extends BaseSupportFragment implements Load
|
||||
return;
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Accounts.COLOR, data.getIntExtra(EXTRA_COLOR, Color.WHITE));
|
||||
final String where = Accounts.ACCOUNT_ID + " = " + mSelectedAccount.account_id;
|
||||
final Expression where = Expression.equals(Accounts.ACCOUNT_ID, mSelectedAccount.account_id);
|
||||
final ContentResolver cr = getContentResolver();
|
||||
cr.update(Accounts.CONTENT_URI, values, where, null);
|
||||
cr.update(Accounts.CONTENT_URI, values, where.getSQL(), null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -120,12 +119,6 @@ public class AccountsManagerFragment extends BaseSupportFragment implements Load
|
||||
mSelectedAccount = mAdapter.getAccount(info.position);
|
||||
if (mSelectedAccount == null) return false;
|
||||
switch (item.getItemId()) {
|
||||
case MENU_SET_AS_DEFAULT: {
|
||||
final Editor editor = mPreferences.edit();
|
||||
editor.putLong(KEY_DEFAULT_ACCOUNT_ID, mSelectedAccount.account_id);
|
||||
editor.apply();
|
||||
return true;
|
||||
}
|
||||
case MENU_SET_COLOR: {
|
||||
final Intent intent = new Intent(getActivity(), ColorPickerDialogActivity.class);
|
||||
intent.putExtra(EXTRA_COLOR, mSelectedAccount.color);
|
||||
@ -203,8 +196,6 @@ public class AccountsManagerFragment extends BaseSupportFragment implements Load
|
||||
menu.setHeaderTitle(account.name);
|
||||
final MenuInflater inflater = new MenuInflater(v.getContext());
|
||||
inflater.inflate(R.menu.action_manager_account, menu);
|
||||
final boolean isDefault = Utils.getDefaultAccountId(getActivity()) == account.account_id;
|
||||
Utils.setMenuItemAvailability(menu, MENU_SET_AS_DEFAULT, !isDefault);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +81,7 @@ public class TrendsLocationPreference extends Preference implements Constants, O
|
||||
final Location item = mAdapter.getItem(which);
|
||||
if (item != null) {
|
||||
editor.putInt(KEY_LOCAL_TRENDS_WOEID, item.getWoeid());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
if (mDialog != null && mDialog.isShowing()) {
|
||||
mDialog.dismiss();
|
||||
|
@ -27,10 +27,11 @@ import org.mariotaku.twidere.Constants;
|
||||
|
||||
public class PositionManager implements Constants {
|
||||
|
||||
private final SharedPreferences mPreferences;
|
||||
private final SharedPreferencesWrapper mPreferences;
|
||||
|
||||
public PositionManager(final Context context) {
|
||||
mPreferences = context.getSharedPreferences(TIMELINE_POSITIONS_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
mPreferences = SharedPreferencesWrapper.getInstance(context,
|
||||
TIMELINE_POSITIONS_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public long getPosition(final String key) {
|
||||
|
@ -1795,8 +1795,10 @@ public final class Utils implements Constants, TwitterConstants {
|
||||
return child.getTop();
|
||||
}
|
||||
|
||||
|
||||
public static HttpClientWrapper getHttpClient(final Context context, final int timeoutMillis,
|
||||
final boolean ignoreSslError, final Proxy proxy, final HostAddressResolverFactory resolverFactory,
|
||||
final boolean ignoreSslError, final Proxy proxy,
|
||||
final HostAddressResolverFactory resolverFactory,
|
||||
final String userAgent, final boolean twitterClientHeader) {
|
||||
final ConfigurationBuilder cb = new ConfigurationBuilder();
|
||||
cb.setHttpConnectionTimeout(timeoutMillis);
|
||||
@ -1817,6 +1819,17 @@ public final class Utils implements Constants, TwitterConstants {
|
||||
return new HttpClientWrapper(cb.build());
|
||||
}
|
||||
|
||||
public static HttpClientWrapper getDefaultHttpClient(final Context context) {
|
||||
if (context == null) return null;
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final int timeoutMillis = prefs.getInt(KEY_CONNECTION_TIMEOUT, 10000) * 1000;
|
||||
final Proxy proxy = getProxy(context);
|
||||
final String userAgent = generateBrowserUserAgent();
|
||||
final HostAddressResolverFactory resolverFactory = new TwidereHostResolverFactory(
|
||||
TwidereApplication.getInstance(context));
|
||||
return getHttpClient(context, timeoutMillis, true, proxy, resolverFactory, userAgent, false);
|
||||
}
|
||||
|
||||
public static HttpClientWrapper getImageLoaderHttpClient(final Context context) {
|
||||
if (context == null) return null;
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
|
@ -22,13 +22,16 @@ package org.mariotaku.twidere.view;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@ -39,13 +42,33 @@ import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor.OutlineCompat;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor.ViewOutlineProviderCompat;
|
||||
import org.mariotaku.twidere.view.helper.PressElevateViewHelper;
|
||||
import org.mariotaku.twidere.view.iface.IHomeActionButton;
|
||||
|
||||
import me.uucky.colorpicker.internal.EffectViewHelper;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public class HomeActionButton extends FrameLayout implements IHomeActionButton {
|
||||
|
||||
private final PressElevateViewHelper mHelper;
|
||||
private static class PressElevationProperty extends Property<View, Float> {
|
||||
private final float mElevation;
|
||||
|
||||
public PressElevationProperty(float elevation) {
|
||||
super(Float.TYPE, null);
|
||||
mElevation = elevation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(View object, Float value) {
|
||||
ViewCompat.setTranslationZ(object, mElevation * value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float get(View object) {
|
||||
return ViewCompat.getTranslationZ(object) / mElevation;
|
||||
}
|
||||
}
|
||||
|
||||
private final EffectViewHelper mHelper;
|
||||
private final ImageView mIconView;
|
||||
private final ProgressBar mProgressBar;
|
||||
|
||||
@ -59,7 +82,9 @@ public class HomeActionButton extends FrameLayout implements IHomeActionButton {
|
||||
|
||||
public HomeActionButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mHelper = new PressElevateViewHelper(this);
|
||||
final Resources resources = context.getResources();
|
||||
final float elevation = resources.getDisplayMetrics().density * 4;
|
||||
mHelper = new EffectViewHelper(this, new PressElevationProperty(elevation), 200);
|
||||
inflate(ThemeUtils.getActionBarContext(context), R.layout.action_item_home_actions, this);
|
||||
mIconView = (ImageView) findViewById(android.R.id.icon);
|
||||
mProgressBar = (ProgressBar) findViewById(android.R.id.progress);
|
||||
@ -112,11 +137,8 @@ public class HomeActionButton extends FrameLayout implements IHomeActionButton {
|
||||
|
||||
@Override
|
||||
public void setPressed(boolean pressed) {
|
||||
final boolean oldState = mHelper.getState();
|
||||
super.setPressed(pressed);
|
||||
final boolean state = mHelper.getState();
|
||||
if (oldState == state) return;
|
||||
mHelper.updateButtonState();
|
||||
mHelper.setState(pressed);
|
||||
}
|
||||
|
||||
private static class HomeActionButtonOutlineProvider extends ViewOutlineProviderCompat {
|
||||
|
@ -33,7 +33,6 @@ public class AccountViewHolder {
|
||||
public final TextView name, screen_name;
|
||||
public final CheckBox checkbox;
|
||||
private final ColorLabelRelativeLayout content;
|
||||
private final View default_indicator;
|
||||
private final View drag_handle;
|
||||
|
||||
public AccountViewHolder(final View view) {
|
||||
@ -41,7 +40,6 @@ public class AccountViewHolder {
|
||||
name = (TextView) view.findViewById(android.R.id.text1);
|
||||
screen_name = (TextView) view.findViewById(android.R.id.text2);
|
||||
profile_image = (ImageView) view.findViewById(android.R.id.icon);
|
||||
default_indicator = view.findViewById(R.id.default_indicator);
|
||||
checkbox = (CheckBox) view.findViewById(android.R.id.checkbox);
|
||||
drag_handle = view.findViewById(R.id.drag_handle);
|
||||
}
|
||||
@ -50,10 +48,6 @@ public class AccountViewHolder {
|
||||
content.drawEnd(color);
|
||||
}
|
||||
|
||||
public void setIsDefault(final boolean is_default) {
|
||||
default_indicator.setVisibility(is_default ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void setSortEnabled(boolean enabled) {
|
||||
drag_handle.setVisibility(enabled ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
@ -56,33 +56,21 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/default_account"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ActivatedCheckBox
|
||||
|
@ -1,9 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@id/set_as_default"
|
||||
android:icon="@drawable/ic_action_checked"
|
||||
android:title="@string/set_as_default"/>
|
||||
<item
|
||||
android:id="@id/set_color"
|
||||
android:icon="@drawable/ic_action_color_palette"
|
||||
|
BIN
twidere/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
twidere/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
twidere/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
twidere/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
twidere/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.7 KiB |
@ -733,5 +733,8 @@
|
||||
<string name="no_tab">No tab</string>
|
||||
<string name="user_protected_summary">You need to send follow request to this protected user to see tweets</string>
|
||||
<string name="no_account">No account</string>
|
||||
<string name="permission_description_shorten_status">Application can shorten tweet for Twidere, so it can access your tweet to send.</string>
|
||||
<string name="permission_description_upload_media">Application can upload media for Twidere, so it can access media in your tweet to send.</string>
|
||||
<string name="permission_description_sync_timeline">Application can sync read position for Twidere, so it can access your read position.</string>
|
||||
|
||||
</resources>
|
BIN
twidere/web_hi_res_512.png
Executable file
After Width: | Height: | Size: 24 KiB |