dm crash fixes
This commit is contained in:
parent
a5901eaab8
commit
39afb636c9
|
@ -42,6 +42,7 @@ import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.support.v7.widget.ActionBarContextView;
|
import android.support.v7.widget.ActionBarContextView;
|
||||||
|
|
||||||
import com.afollestad.appthemeengine.ATE;
|
import com.afollestad.appthemeengine.ATE;
|
||||||
|
import com.afollestad.appthemeengine.Config;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.mariotaku.twidere.BuildConfig;
|
import org.mariotaku.twidere.BuildConfig;
|
||||||
|
@ -134,9 +135,15 @@ public class TwidereApplication extends Application implements Constants,
|
||||||
if (!ATE.config(this, null).isConfigured()) {
|
if (!ATE.config(this, null).isConfigured()) {
|
||||||
final int themeColor = preferences.getInt(KEY_THEME_COLOR, ContextCompat.getColor(this,
|
final int themeColor = preferences.getInt(KEY_THEME_COLOR, ContextCompat.getColor(this,
|
||||||
R.color.branding_color));
|
R.color.branding_color));
|
||||||
ATE.config(this, "light").primaryColor(themeColor).accentColor(themeColor).coloredActionBar(true).commit();
|
ATE.config(this, VALUE_THEME_NAME_LIGHT)
|
||||||
ATE.config(this, "dark").accentColor(themeColor).coloredActionBar(false).commit();
|
.primaryColor(themeColor)
|
||||||
ATE.config(this, null).primaryColor(themeColor).accentColor(themeColor).commit();
|
.accentColor(themeColor)
|
||||||
|
.coloredActionBar(true)
|
||||||
|
.commit();
|
||||||
|
ATE.config(this, VALUE_THEME_NAME_DARK)
|
||||||
|
.accentColor(themeColor)
|
||||||
|
.coloredActionBar(false)
|
||||||
|
.commit();
|
||||||
}
|
}
|
||||||
resetTheme(preferences);
|
resetTheme(preferences);
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
@ -277,12 +284,25 @@ public class TwidereApplication extends Application implements Constants,
|
||||||
}
|
}
|
||||||
case KEY_THEME: {
|
case KEY_THEME: {
|
||||||
resetTheme(preferences);
|
resetTheme(preferences);
|
||||||
|
Config.markChanged(this, VALUE_THEME_NAME_LIGHT, VALUE_THEME_NAME_DARK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case KEY_THEME_BACKGROUND: {
|
||||||
|
Config.markChanged(this, VALUE_THEME_NAME_LIGHT, VALUE_THEME_NAME_DARK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KEY_THEME_COLOR: {
|
case KEY_THEME_COLOR: {
|
||||||
final int themeColor = preferences.getInt(key, ContextCompat.getColor(this, R.color.branding_color));
|
final int themeColor = preferences.getInt(key, ContextCompat.getColor(this,
|
||||||
ATE.config(this, "light").primaryColor(themeColor).accentColor(themeColor).coloredActionBar(true).commit();
|
R.color.branding_color));
|
||||||
ATE.config(this, "dark").accentColor(themeColor).coloredActionBar(false).commit();
|
ATE.config(this, VALUE_THEME_NAME_LIGHT)
|
||||||
|
.primaryColor(themeColor)
|
||||||
|
.accentColor(themeColor)
|
||||||
|
.coloredActionBar(true)
|
||||||
|
.commit();
|
||||||
|
ATE.config(this, VALUE_THEME_NAME_DARK)
|
||||||
|
.accentColor(themeColor)
|
||||||
|
.coloredActionBar(false)
|
||||||
|
.commit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
||||||
if (args.containsKey(EXTRA_ACCOUNT)) {
|
if (args.containsKey(EXTRA_ACCOUNT)) {
|
||||||
account = args.getParcelable(EXTRA_ACCOUNT);
|
account = args.getParcelable(EXTRA_ACCOUNT);
|
||||||
recipient = args.getParcelable(EXTRA_USER);
|
recipient = args.getParcelable(EXTRA_USER);
|
||||||
} else if (args.containsKey(EXTRA_ACCOUNT_KEY)) {
|
} else if (args.containsKey(EXTRA_ACCOUNT_KEY) && args.containsKey(EXTRA_RECIPIENT_ID)) {
|
||||||
final UserKey accountKey = args.getParcelable(EXTRA_ACCOUNT_KEY);
|
final UserKey accountKey = args.getParcelable(EXTRA_ACCOUNT_KEY);
|
||||||
if (accountKey == null) {
|
if (accountKey == null) {
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
|
@ -314,9 +314,16 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
||||||
mAccountSpinner.setSelection(accountPos);
|
mAccountSpinner.setSelection(accountPos);
|
||||||
}
|
}
|
||||||
final String userId = args.getString(EXTRA_RECIPIENT_ID);
|
final String userId = args.getString(EXTRA_RECIPIENT_ID);
|
||||||
account = accountPos >= 0 ? accountsSpinnerAdapter.getItem(accountPos) :
|
if (accountPos >= 0) {
|
||||||
ParcelableCredentialsUtils.getCredentials(activity, accountKey);
|
account = accountsSpinnerAdapter.getItem(accountPos);
|
||||||
recipient = Utils.getUserForConversation(activity, accountKey, userId);
|
} else {
|
||||||
|
account = ParcelableCredentialsUtils.getCredentials(activity, accountKey);
|
||||||
|
}
|
||||||
|
if (userId != null) {
|
||||||
|
recipient = Utils.getUserForConversation(activity, accountKey, userId);
|
||||||
|
} else {
|
||||||
|
recipient = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
account = null;
|
account = null;
|
||||||
recipient = null;
|
recipient = null;
|
||||||
|
|
|
@ -2485,18 +2485,20 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
||||||
countValues.put(Statuses.RETWEET_COUNT, activitySummary.retweetCount);
|
countValues.put(Statuses.RETWEET_COUNT, activitySummary.retweetCount);
|
||||||
|
|
||||||
final ContentResolver cr = context.getContentResolver();
|
final ContentResolver cr = context.getContentResolver();
|
||||||
final Expression statusWhere = Expression.or(
|
final Expression statusWhere = Expression.and(
|
||||||
Expression.equalsArgs(Statuses.ACCOUNT_KEY),
|
Expression.equalsArgs(Statuses.ACCOUNT_KEY),
|
||||||
Expression.equalsArgs(Statuses.STATUS_ID),
|
Expression.or(
|
||||||
Expression.equalsArgs(Statuses.RETWEET_ID)
|
Expression.equalsArgs(Statuses.STATUS_ID),
|
||||||
);
|
Expression.equalsArgs(Statuses.RETWEET_ID)
|
||||||
|
));
|
||||||
final String[] statusWhereArgs = {mAccountKey.toString(), mStatusId, mStatusId};
|
final String[] statusWhereArgs = {mAccountKey.toString(), mStatusId, mStatusId};
|
||||||
cr.update(Statuses.CONTENT_URI, countValues, statusWhere.getSQL(), statusWhereArgs);
|
cr.update(Statuses.CONTENT_URI, countValues, statusWhere.getSQL(), statusWhereArgs);
|
||||||
final Expression activityWhere = Expression.or(
|
final Expression activityWhere = Expression.and(
|
||||||
Expression.equalsArgs(Activities.ACCOUNT_KEY),
|
Expression.equalsArgs(Activities.ACCOUNT_KEY),
|
||||||
Expression.equalsArgs(Activities.STATUS_ID),
|
Expression.or(
|
||||||
Expression.equalsArgs(Activities.STATUS_RETWEET_ID)
|
Expression.equalsArgs(Activities.STATUS_ID),
|
||||||
);
|
Expression.equalsArgs(Activities.STATUS_RETWEET_ID)
|
||||||
|
));
|
||||||
|
|
||||||
final ParcelableStatus pStatus = ParcelableStatusUtils.fromStatus(status,
|
final ParcelableStatus pStatus = ParcelableStatusUtils.fromStatus(status,
|
||||||
mAccountKey, false);
|
mAccountKey, false);
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -30,7 +31,8 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="@dimen/element_spacing_small"
|
android:layout_margin="@dimen/element_spacing_small"
|
||||||
tools:listitem="@layout/spinner_item_account_icon" />
|
android:tag="tint|primary_color_dependent"
|
||||||
|
tools:listitem="@layout/spinner_item_account_icon"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -46,9 +48,10 @@
|
||||||
android:layout_marginLeft="@dimen/element_spacing_normal"
|
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:inputType="textPersonName|textMultiLine">
|
android:inputType="textPersonName|textMultiLine"
|
||||||
|
android:tag="background|primary_color_dependent">
|
||||||
|
|
||||||
<requestFocus />
|
<requestFocus/>
|
||||||
</EditText>
|
</EditText>
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.themed.BackgroundTintImageButton
|
<org.mariotaku.twidere.view.themed.BackgroundTintImageButton
|
||||||
|
@ -60,7 +63,7 @@
|
||||||
android:color="?android:textColorPrimary"
|
android:color="?android:textColorPrimary"
|
||||||
android:padding="@dimen/element_spacing_normal"
|
android:padding="@dimen/element_spacing_normal"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_search" />
|
android:src="@drawable/ic_action_search"/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
Reference in New Issue