removing MenuComponent library
redesigning compose dialog
This commit is contained in:
parent
8a15ff2bc5
commit
43bca1b273
|
@ -207,5 +207,8 @@ public interface IntentConstants {
|
|||
public static final String EXTRA_MY_FOLLOWING_ONLY = "my_following_only";
|
||||
public static final String EXTRA_RESTART_ACTIVITY = "restart_activity";
|
||||
public static final String EXTRA_FROM_USER = "from_user";
|
||||
public static final String EXTRA_BITMAP = "bitmap";
|
||||
public static final String EXTRA_SOURCE = "source";
|
||||
public static final String EXTRA_DESTINATION = "destination";
|
||||
|
||||
}
|
||||
|
|
|
@ -18,25 +18,23 @@ package twitter4j;
|
|||
|
||||
/**
|
||||
* A data interface representing search API response
|
||||
*
|
||||
*
|
||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||
*/
|
||||
public interface QueryResult {
|
||||
double getCompletedIn();
|
||||
public interface QueryResult extends ResponseList<Status> {
|
||||
double getCompletedIn();
|
||||
|
||||
long getMaxId();
|
||||
long getMaxId();
|
||||
|
||||
int getPage();
|
||||
int getPage();
|
||||
|
||||
String getQuery();
|
||||
String getQuery();
|
||||
|
||||
String getRefreshUrl();
|
||||
String getRefreshUrl();
|
||||
|
||||
int getResultsPerPage();
|
||||
int getResultsPerPage();
|
||||
|
||||
long getSinceId();
|
||||
long getSinceId();
|
||||
|
||||
Status[] getStatuses();
|
||||
|
||||
String getWarning();
|
||||
String getWarning();
|
||||
}
|
||||
|
|
|
@ -1331,10 +1331,11 @@ final class TwitterImpl extends TwitterBaseImpl implements Twitter {
|
|||
|
||||
@Override
|
||||
public QueryResult search(final Query query) throws TwitterException {
|
||||
return factory.createQueryResult(
|
||||
get(conf.getRestBaseURL() + ENDPOINT_SEARCH_TWEETS, conf.getSigningRestBaseURL()
|
||||
+ ENDPOINT_SEARCH_TWEETS, query.asHttpParameterArray(INCLUDE_ENTITIES,
|
||||
INCLUDE_RTS, INCLUDE_REPLY_COUNT, INCLUDE_DESCENDENT_REPLY_COUNT)), query);
|
||||
final String url = conf.getRestBaseURL() + ENDPOINT_SEARCH_TWEETS;
|
||||
final String signUrl = conf.getSigningRestBaseURL() + ENDPOINT_SEARCH_TWEETS;
|
||||
return factory.createQueryResult(get(url, signUrl,
|
||||
query.asHttpParameterArray(INCLUDE_ENTITIES, INCLUDE_RTS, INCLUDE_REPLY_COUNT,
|
||||
INCLUDE_DESCENDENT_REPLY_COUNT)), query);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import twitter4j.Query;
|
||||
import twitter4j.QueryResult;
|
||||
import twitter4j.Status;
|
||||
|
@ -40,175 +38,149 @@ import static twitter4j.internal.util.InternalParseUtil.getURLDecodedString;
|
|||
|
||||
/**
|
||||
* A data class representing search API response
|
||||
*
|
||||
*
|
||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||
*/
|
||||
/* package */final class QueryResultJSONImpl implements QueryResult {
|
||||
/* package */final class QueryResultJSONImpl extends ResponseListImpl<Status> implements QueryResult {
|
||||
|
||||
private long sinceId;
|
||||
private long maxId;
|
||||
private String refreshUrl;
|
||||
private int resultsPerPage;
|
||||
private String warning;
|
||||
private double completedIn;
|
||||
private int page;
|
||||
private String query;
|
||||
private Status[] statuses;
|
||||
private long sinceId;
|
||||
private long maxId;
|
||||
private String refreshUrl;
|
||||
private int resultsPerPage;
|
||||
private String warning;
|
||||
private double completedIn;
|
||||
private int page;
|
||||
private String query;
|
||||
|
||||
/* package */QueryResultJSONImpl(final HttpResponse res) throws TwitterException {
|
||||
final JSONObject json = res.asJSONObject();
|
||||
try {
|
||||
final JSONObject search_metadata = json.getJSONObject("search_metadata");
|
||||
sinceId = getLong("since_id", search_metadata);
|
||||
maxId = getLong("max_id", search_metadata);
|
||||
refreshUrl = getHTMLUnescapedString("refresh_url", search_metadata);
|
||||
/* package */QueryResultJSONImpl(final HttpResponse res) throws TwitterException {
|
||||
super(res);
|
||||
final JSONObject json = res.asJSONObject();
|
||||
try {
|
||||
final JSONObject search_metadata = json.getJSONObject("search_metadata");
|
||||
sinceId = getLong("since_id", search_metadata);
|
||||
maxId = getLong("max_id", search_metadata);
|
||||
refreshUrl = getHTMLUnescapedString("refresh_url", search_metadata);
|
||||
|
||||
resultsPerPage = getInt("results_per_page", search_metadata);
|
||||
warning = getRawString("warning", search_metadata);
|
||||
completedIn = getDouble("completed_in", search_metadata);
|
||||
page = getInt("page", search_metadata);
|
||||
query = getURLDecodedString("query", search_metadata);
|
||||
final JSONArray array = json.getJSONArray("statuses");
|
||||
final int statuses_length = array.length();
|
||||
statuses = new Status[statuses_length];
|
||||
for (int i = 0; i < statuses_length; i++) {
|
||||
final JSONObject tweet = array.getJSONObject(i);
|
||||
statuses[i] = new StatusJSONImpl(tweet);
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
|
||||
}
|
||||
}
|
||||
resultsPerPage = getInt("results_per_page", search_metadata);
|
||||
warning = getRawString("warning", search_metadata);
|
||||
completedIn = getDouble("completed_in", search_metadata);
|
||||
page = getInt("page", search_metadata);
|
||||
query = getURLDecodedString("query", search_metadata);
|
||||
final JSONArray array = json.getJSONArray("statuses");
|
||||
for (int i = 0, j = array.length(); i < j; i++) {
|
||||
final JSONObject tweet = array.getJSONObject(i);
|
||||
add(new StatusJSONImpl(tweet));
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
|
||||
}
|
||||
}
|
||||
|
||||
/* package */QueryResultJSONImpl(final Query query) {
|
||||
super();
|
||||
sinceId = query.getSinceId();
|
||||
resultsPerPage = query.getRpp();
|
||||
page = query.getPage();
|
||||
statuses = new Status[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final QueryResult that = (QueryResult) o;
|
||||
|
||||
if (Double.compare(that.getCompletedIn(), completedIn) != 0) return false;
|
||||
if (maxId != that.getMaxId()) return false;
|
||||
if (page != that.getPage()) return false;
|
||||
if (resultsPerPage != that.getResultsPerPage()) return false;
|
||||
if (sinceId != that.getSinceId()) return false;
|
||||
if (!query.equals(that.getQuery())) return false;
|
||||
if (refreshUrl != null ? !refreshUrl.equals(that.getRefreshUrl()) : that.getRefreshUrl() != null) return false;
|
||||
if (statuses != null ? !Arrays.equals(statuses, that.getStatuses()) : that.getStatuses() != null) return false;
|
||||
if (warning != null ? !warning.equals(that.getWarning()) : that.getWarning() != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public double getCompletedIn() {
|
||||
return completedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getMaxId() {
|
||||
return maxId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRefreshUrl() {
|
||||
return refreshUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getResultsPerPage() {
|
||||
return resultsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getSinceId() {
|
||||
return sinceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Status[] getStatuses() {
|
||||
return statuses;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getWarning() {
|
||||
return warning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
result = (int) (sinceId ^ sinceId >>> 32);
|
||||
result = 31 * result + (int) (maxId ^ maxId >>> 32);
|
||||
result = 31 * result + (refreshUrl != null ? refreshUrl.hashCode() : 0);
|
||||
result = 31 * result + resultsPerPage;
|
||||
result = 31 * result + (warning != null ? warning.hashCode() : 0);
|
||||
temp = completedIn != +0.0d ? Double.doubleToLongBits(completedIn) : 0L;
|
||||
result = 31 * result + (int) (temp ^ temp >>> 32);
|
||||
result = 31 * result + page;
|
||||
result = 31 * result + query.hashCode();
|
||||
result = 31 * result + (statuses != null ? Arrays.hashCode(statuses) : 0);
|
||||
return result;
|
||||
}
|
||||
/* package */QueryResultJSONImpl(final HttpResponse res, final Query query) {
|
||||
super(res);
|
||||
sinceId = query.getSinceId();
|
||||
resultsPerPage = query.getRpp();
|
||||
page = query.getPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryResultJSONImpl{" +
|
||||
"sinceId=" + sinceId +
|
||||
", maxId=" + maxId +
|
||||
", refreshUrl='" + refreshUrl + '\'' +
|
||||
", resultsPerPage=" + resultsPerPage +
|
||||
", warning='" + warning + '\'' +
|
||||
", completedIn=" + completedIn +
|
||||
", page=" + page +
|
||||
", query='" + query + '\'' +
|
||||
", statuses=" + Arrays.toString(statuses) +
|
||||
'}';
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final QueryResult that = (QueryResult) o;
|
||||
|
||||
if (Double.compare(that.getCompletedIn(), completedIn) != 0) return false;
|
||||
if (maxId != that.getMaxId()) return false;
|
||||
if (page != that.getPage()) return false;
|
||||
if (resultsPerPage != that.getResultsPerPage()) return false;
|
||||
if (sinceId != that.getSinceId()) return false;
|
||||
if (!query.equals(that.getQuery())) return false;
|
||||
if (refreshUrl != null ? !refreshUrl.equals(that.getRefreshUrl()) : that.getRefreshUrl() != null)
|
||||
return false;
|
||||
if (warning != null ? !warning.equals(that.getWarning()) : that.getWarning() != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public double getCompletedIn() {
|
||||
return completedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getMaxId() {
|
||||
return maxId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getRefreshUrl() {
|
||||
return refreshUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getResultsPerPage() {
|
||||
return resultsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getSinceId() {
|
||||
return sinceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getWarning() {
|
||||
return warning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
long temp;
|
||||
result = 31 * result + (int) (sinceId ^ (sinceId >>> 32));
|
||||
result = 31 * result + (int) (maxId ^ (maxId >>> 32));
|
||||
result = 31 * result + (refreshUrl != null ? refreshUrl.hashCode() : 0);
|
||||
result = 31 * result + resultsPerPage;
|
||||
result = 31 * result + (warning != null ? warning.hashCode() : 0);
|
||||
temp = Double.doubleToLongBits(completedIn);
|
||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
result = 31 * result + page;
|
||||
result = 31 * result + (query != null ? query.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ android {
|
|||
targetSdkVersion 21
|
||||
versionCode 99
|
||||
versionName "0.3.0-dev"
|
||||
|
||||
multiDexEnabled true
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
|
@ -50,6 +50,7 @@ dependencies {
|
|||
// wearApp project(':twidere.wear')
|
||||
compile 'com.android.support:multidex:1.0.1'
|
||||
compile 'com.android.support:support-v13:21.0.3'
|
||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||
compile 'com.android.support:cardview-v7:21.0.3'
|
||||
compile 'com.android.support:recyclerview-v7:21.0.3'
|
||||
compile 'com.android.support:palette-v7:21.0.3'
|
||||
|
@ -70,10 +71,8 @@ dependencies {
|
|||
fdroidCompile 'org.slf4j:slf4j-simple:1.7.10'
|
||||
compile project(':twidere.component.common')
|
||||
compile project(':twidere.component.nyan')
|
||||
compile project(':twidere.component.viewer.media')
|
||||
compile project(':SlidingMenu')
|
||||
compile project(':DragSortListView')
|
||||
compile project(':MenuComponent')
|
||||
compile project(':MessageBubbleView')
|
||||
compile fileTree(dir: 'libs/main', include: ['*.jar'])
|
||||
googleCompile fileTree(dir: 'libs/google', include: ['*.jar'])
|
||||
|
|
|
@ -82,7 +82,6 @@ public interface Constants extends TwidereConstants {
|
|||
public static final int MENU_VIEW_USER_LIST = R.id.view_user_list;
|
||||
public static final int MENU_UP = R.id.up;
|
||||
public static final int MENU_DOWN = R.id.down;
|
||||
public static final int MENU_MULTI_SELECT = R.id.multi_select;
|
||||
public static final int MENU_COPY = R.id.copy;
|
||||
public static final int MENU_TOGGLE_SENSITIVE = R.id.toggle_sensitive;
|
||||
public static final int MENU_REVOKE = R.id.revoke;
|
||||
|
|
|
@ -19,13 +19,9 @@
|
|||
|
||||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.ActionBar.Tab;
|
||||
import android.app.ActionBar.TabListener;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.app.Dialog;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
|
@ -36,10 +32,15 @@ import android.content.SharedPreferences;
|
|||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.view.ViewPager.OnPageChangeListener;
|
||||
import android.support.v4.widget.SimpleCursorAdapter;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBar.Tab;
|
||||
import android.support.v7.app.ActionBar.TabListener;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -79,7 +80,8 @@ public class FiltersActivity extends BaseSupportActivity implements TabListener,
|
|||
private SharedPreferences mPreferences;
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
}
|
||||
|
||||
|
@ -154,7 +156,7 @@ public class FiltersActivity extends BaseSupportActivity implements TabListener,
|
|||
super.onCreate(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
setContentView(R.layout.activity_filters);
|
||||
mActionBar = getActionBar();
|
||||
mActionBar = getSupportActionBar();
|
||||
mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null);
|
||||
mActionBar.setDisplayHomeAsUpEnabled(true);
|
||||
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
|
@ -245,6 +247,7 @@ public class FiltersActivity extends BaseSupportActivity implements TabListener,
|
|||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Context wrapped = ThemeUtils.getDialogThemedContext(getActivity());
|
||||
|
|
|
@ -99,8 +99,8 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mEditAPIUrlFormat = (EditText) findViewById(R.id.api_url_format);
|
||||
mEditAuthType = (RadioGroup) findViewById(R.id.auth_type);
|
||||
mButtonOAuth = (RadioButton) findViewById(R.id.oauth);
|
||||
|
|
|
@ -66,8 +66,6 @@ public class AccountSelectorActivity extends BaseSupportDialogActivity implement
|
|||
|
||||
private boolean mFirstCreated;
|
||||
|
||||
private View mSelectAccountDivider;
|
||||
|
||||
private View mSelectAccountButtons;
|
||||
|
||||
@Override
|
||||
|
@ -89,10 +87,9 @@ public class AccountSelectorActivity extends BaseSupportDialogActivity implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mListView = (ListView) findViewById(android.R.id.list);
|
||||
mSelectAccountDivider = findViewById(R.id.select_account_divider);
|
||||
mSelectAccountButtons = findViewById(R.id.select_account_buttons);
|
||||
}
|
||||
|
||||
|
@ -140,7 +137,6 @@ public class AccountSelectorActivity extends BaseSupportDialogActivity implement
|
|||
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);
|
||||
|
|
|
@ -17,57 +17,57 @@ import org.mariotaku.twidere.loader.support.IntentActivitiesLoader;
|
|||
import java.util.List;
|
||||
|
||||
public class ActivityPickerActivity extends BaseSupportDialogActivity implements LoaderCallbacks<List<ResolveInfo>>,
|
||||
OnItemClickListener {
|
||||
OnItemClickListener {
|
||||
|
||||
private ResolveInfoListAdapter mAdapter;
|
||||
private ResolveInfoListAdapter mAdapter;
|
||||
|
||||
private ListView mListView;
|
||||
private ListView mListView;
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
mListView = (ListView) findViewById(android.R.id.list);
|
||||
}
|
||||
@Override
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mListView = (ListView) findViewById(android.R.id.list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<List<ResolveInfo>> onCreateLoader(final int id, final Bundle args) {
|
||||
final Intent intent = getIntent();
|
||||
final Intent extraIntent = intent.getParcelableExtra(EXTRA_INTENT);
|
||||
@Override
|
||||
public Loader<List<ResolveInfo>> onCreateLoader(final int id, final Bundle args) {
|
||||
final Intent intent = getIntent();
|
||||
final Intent extraIntent = intent.getParcelableExtra(EXTRA_INTENT);
|
||||
|
||||
final String[] blacklist = intent.getStringArrayExtra(EXTRA_BLACKLIST);
|
||||
return new IntentActivitiesLoader(this, extraIntent, blacklist, 0);
|
||||
}
|
||||
final String[] blacklist = intent.getStringArrayExtra(EXTRA_BLACKLIST);
|
||||
return new IntentActivitiesLoader(this, extraIntent, blacklist, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final Intent intent = getIntent(), data = new Intent();
|
||||
data.putExtra(EXTRA_DATA, mAdapter.getItem(position));
|
||||
data.putExtra(EXTRA_INTENT, intent.getParcelableExtra(EXTRA_INTENT));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final Intent intent = getIntent(), data = new Intent();
|
||||
data.putExtra(EXTRA_DATA, mAdapter.getItem(position));
|
||||
data.putExtra(EXTRA_INTENT, intent.getParcelableExtra(EXTRA_INTENT));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(final Loader<List<ResolveInfo>> loader) {
|
||||
mAdapter.clear();
|
||||
}
|
||||
@Override
|
||||
public void onLoaderReset(final Loader<List<ResolveInfo>> loader) {
|
||||
mAdapter.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(final Loader<List<ResolveInfo>> loader, final List<ResolveInfo> data) {
|
||||
mAdapter.clear();
|
||||
if (data != null) {
|
||||
mAdapter.addAll(data);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onLoadFinished(final Loader<List<ResolveInfo>> loader, final List<ResolveInfo> data) {
|
||||
mAdapter.clear();
|
||||
if (data != null) {
|
||||
mAdapter.addAll(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_activity_picker);
|
||||
mAdapter = new ResolveInfoListAdapter(this);
|
||||
mListView.setAdapter(mAdapter);
|
||||
mListView.setOnItemClickListener(this);
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_activity_picker);
|
||||
mAdapter = new ResolveInfoListAdapter(this);
|
||||
mListView.setAdapter(mAdapter);
|
||||
mListView.setOnItemClickListener(this);
|
||||
getSupportLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,9 +21,14 @@ package org.mariotaku.twidere.activity.support;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.app.SharedElementCallback;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
|
||||
|
@ -34,6 +39,7 @@ import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
|||
import org.mariotaku.twidere.util.MessagesManager;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.MainFrameLayout.FitSystemWindowsCallback;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity implements
|
|||
private GetRequestTokenTask mTask;
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mWebView = (WebView) findViewById(R.id.webview);
|
||||
mProgressContainer = findViewById(R.id.progress_container);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ import android.support.v4.app.FragmentActivity;
|
|||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationCompat.Action;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.ActionMenuView.OnMenuItemClickListener;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.Adapter;
|
||||
|
@ -65,7 +68,6 @@ import android.view.KeyEvent;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -82,10 +84,12 @@ import com.nostra13.universalimageloader.utils.IoUtils;
|
|||
import com.twitter.Extractor;
|
||||
|
||||
import org.mariotaku.dynamicgridview.DraggableArrayAdapter;
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
import org.mariotaku.twidere.menu.ComposeAccountActionProvider;
|
||||
import org.mariotaku.twidere.menu.ComposeAccountActionProvider.InvokedListener;
|
||||
import org.mariotaku.twidere.model.DraftItem;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.model.ParcelableLocation;
|
||||
|
@ -114,7 +118,6 @@ import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
|||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
import org.mariotaku.twidere.view.StatusTextCountView;
|
||||
import org.mariotaku.twidere.view.TwidereMenuBar;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -147,7 +150,7 @@ import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
|||
import static org.mariotaku.twidere.util.Utils.showMenuItemToast;
|
||||
|
||||
public class ComposeActivity extends BaseSupportDialogActivity implements TextWatcher, LocationListener,
|
||||
OnMenuItemClickListener, OnClickListener, OnEditorActionListener, OnLongClickListener {
|
||||
OnMenuItemClickListener, OnClickListener, OnEditorActionListener, OnLongClickListener, InvokedListener {
|
||||
|
||||
private static final String FAKE_IMAGE_LINK = "https://www.example.com/fake_image.jpg";
|
||||
|
||||
|
@ -169,11 +172,12 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
private ContentResolver mResolver;
|
||||
private TwidereAsyncTask<Void, Void, ?> mTask;
|
||||
private GridView mMediaPreviewGrid;
|
||||
private TwidereMenuBar mMenuBar;
|
||||
private ActionMenuView mMenuBar;
|
||||
private EditText mEditText;
|
||||
private View mSendView;
|
||||
private StatusTextCountView mSendTextCountView;
|
||||
private RecyclerView mAccountSelector;
|
||||
private View mAccountSelectorContainer;
|
||||
private MediaPreviewAdapter mMediaPreviewAdapter;
|
||||
private boolean mIsPossiblySensitive, mShouldSaveAccounts;
|
||||
private Uri mTempPhotoUri;
|
||||
|
@ -184,12 +188,19 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
private long mInReplyToStatusId;
|
||||
private String mOriginalText;
|
||||
private AccountIconsAdapter mAccountsAdapter;
|
||||
private ComposeAccountActionProvider mAccountActionProvider;
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInvoked() {
|
||||
final boolean isVisible = mAccountSelectorContainer.getVisibility() == View.VISIBLE;
|
||||
mAccountSelectorContainer.setVisibility(isVisible ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
|
||||
setMenu();
|
||||
|
@ -213,7 +224,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccounts());
|
||||
outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccountIds());
|
||||
outState.putParcelableArrayList(EXTRA_MEDIA, new ArrayList<Parcelable>(getMediaList()));
|
||||
outState.putBoolean(EXTRA_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive);
|
||||
outState.putParcelable(EXTRA_STATUS, mInReplyToStatus);
|
||||
|
@ -282,7 +293,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
try {
|
||||
final String action = intent.getAction();
|
||||
if (INTENT_ACTION_EXTENSION_COMPOSE.equals(action)) {
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccounts();
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccountIds();
|
||||
intent.putExtra(EXTRA_TEXT, ParseUtils.parseString(mEditText.getText()));
|
||||
intent.putExtra(EXTRA_ACCOUNT_IDS, accountIds);
|
||||
if (accountIds.length > 0) {
|
||||
|
@ -437,7 +448,6 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
public void onLocationChanged(final Location location) {
|
||||
if (mRecentLocation == null) {
|
||||
mRecentLocation = location != null ? new ParcelableLocation(location) : null;
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +462,6 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
@Override
|
||||
public void onProviderDisabled(final String provider) {
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -487,15 +496,16 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mEditText = (EditText) findViewById(R.id.edit_text);
|
||||
mMediaPreviewGrid = (GridView) findViewById(R.id.media_thumbnail_preview);
|
||||
mMenuBar = (TwidereMenuBar) findViewById(R.id.menu_bar);
|
||||
mMenuBar = (ActionMenuView) findViewById(R.id.menu_bar);
|
||||
final View composeBottomBar = findViewById(R.id.compose_bottombar);
|
||||
mSendView = composeBottomBar.findViewById(R.id.send);
|
||||
mSendTextCountView = (StatusTextCountView) mSendView.findViewById(R.id.status_text_count);
|
||||
mAccountSelector = (RecyclerView) findViewById(R.id.account_selector);
|
||||
mAccountSelectorContainer = findViewById(R.id.account_selector_container);
|
||||
ViewAccessor.setBackground(findViewById(R.id.compose_content), getWindowContentOverlayForCompose(this));
|
||||
}
|
||||
|
||||
|
@ -507,7 +517,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
public void saveToDrafts() {
|
||||
final String text = mEditText != null ? ParseUtils.parseString(mEditText.getText()) : null;
|
||||
final ParcelableStatusUpdate.Builder builder = new ParcelableStatusUpdate.Builder();
|
||||
builder.accounts(ParcelableAccount.getAccounts(this, mAccountsAdapter.getSelectedAccounts()));
|
||||
builder.accounts(ParcelableAccount.getAccounts(this, mAccountsAdapter.getSelectedAccountIds()));
|
||||
builder.text(text);
|
||||
builder.inReplyToStatusId(mInReplyToStatusId);
|
||||
builder.location(mRecentLocation);
|
||||
|
@ -540,13 +550,14 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
mMenuBar.setIsBottomBar(true);
|
||||
// mMenuBar.setIsBottomBar(true);
|
||||
mMenuBar.setOnMenuItemClickListener(this);
|
||||
mEditText.setOnEditorActionListener(mPreferences.getBoolean(KEY_QUICK_SEND, false) ? this : null);
|
||||
mEditText.addTextChangedListener(this);
|
||||
|
||||
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
linearLayoutManager.setStackFromEnd(true);
|
||||
mAccountSelector.setLayoutManager(linearLayoutManager);
|
||||
mAccountSelector.addItemDecoration(new SpacingItemDecoration(this));
|
||||
mAccountsAdapter = new AccountIconsAdapter(this);
|
||||
|
@ -558,9 +569,10 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
final Intent intent = getIntent();
|
||||
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
// Restore from previous saved state
|
||||
mAccountsAdapter.setSelectedAccounts(savedInstanceState.getLongArray(EXTRA_ACCOUNT_IDS));
|
||||
mAccountsAdapter.setSelectedAccountIds(savedInstanceState.getLongArray(EXTRA_ACCOUNT_IDS));
|
||||
mIsPossiblySensitive = savedInstanceState.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE);
|
||||
final ArrayList<ParcelableMediaUpdate> mediaList = savedInstanceState.getParcelableArrayList(EXTRA_MEDIA);
|
||||
if (mediaList != null) {
|
||||
|
@ -583,12 +595,12 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (!handleIntent(intent)) {
|
||||
handleDefaultIntent(intent);
|
||||
}
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccounts();
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccountIds();
|
||||
if (accountIds.length == 0) {
|
||||
final long[] idsInPrefs = TwidereArrayUtils.parseLongArray(
|
||||
mPreferences.getString(KEY_COMPOSE_ACCOUNTS, null), ',');
|
||||
final long[] intersection = TwidereArrayUtils.intersection(idsInPrefs, defaultAccountIds);
|
||||
mAccountsAdapter.setSelectedAccounts(intersection.length > 0 ? intersection : defaultAccountIds);
|
||||
mAccountsAdapter.setSelectedAccountIds(intersection.length > 0 ? intersection : defaultAccountIds);
|
||||
}
|
||||
mOriginalText = ParseUtils.parseString(mEditText.getText());
|
||||
}
|
||||
|
@ -596,10 +608,14 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
setTitle(R.string.compose);
|
||||
}
|
||||
|
||||
mMenuBar.inflate(R.menu.menu_compose);
|
||||
final Menu menu = mMenuBar.getMenu();
|
||||
getMenuInflater().inflate(R.menu.menu_compose, menu);
|
||||
mAccountActionProvider = (ComposeAccountActionProvider) MenuItemCompat.getActionProvider(menu.findItem(MENU_SELECT_ACCOUNT));
|
||||
mAccountActionProvider.setInvokedListener(this);
|
||||
ThemeUtils.wrapMenuIcon(mMenuBar);
|
||||
|
||||
mSendView.setOnClickListener(this);
|
||||
mSendView.setOnLongClickListener(this);
|
||||
final Menu menu = mMenuBar.getMenu();
|
||||
final Intent composeExtensionsIntent = new Intent(INTENT_ACTION_EXTENSION_COMPOSE);
|
||||
addIntentToMenu(this, menu, composeExtensionsIntent, MENU_GROUP_COMPOSE_EXTENSION);
|
||||
final Intent imageExtensionsIntent = new Intent(INTENT_ACTION_EXTENSION_EDIT_IMAGE);
|
||||
|
@ -609,6 +625,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
setMenu();
|
||||
updateMediaPreview();
|
||||
notifyAccountSelectionChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -712,10 +729,10 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
final String action = intent.getAction();
|
||||
final boolean hasAccountIds;
|
||||
if (intent.hasExtra(EXTRA_ACCOUNT_IDS)) {
|
||||
mAccountsAdapter.setSelectedAccounts(intent.getLongArrayExtra(EXTRA_ACCOUNT_IDS));
|
||||
mAccountsAdapter.setSelectedAccountIds(intent.getLongArrayExtra(EXTRA_ACCOUNT_IDS));
|
||||
hasAccountIds = true;
|
||||
} else if (intent.hasExtra(EXTRA_ACCOUNT_ID)) {
|
||||
mAccountsAdapter.setSelectedAccounts(intent.getLongExtra(EXTRA_ACCOUNT_ID, -1));
|
||||
mAccountsAdapter.setSelectedAccountIds(intent.getLongExtra(EXTRA_ACCOUNT_ID, -1));
|
||||
hasAccountIds = true;
|
||||
} else {
|
||||
hasAccountIds = false;
|
||||
|
@ -753,7 +770,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mEditText.setText(draft.text);
|
||||
final int selection_end = mEditText.length();
|
||||
mEditText.setSelection(selection_end);
|
||||
mAccountsAdapter.setSelectedAccounts(draft.account_ids);
|
||||
mAccountsAdapter.setSelectedAccountIds(draft.account_ids);
|
||||
if (draft.media != null) {
|
||||
addMedia(Arrays.asList(draft.media));
|
||||
}
|
||||
|
@ -806,7 +823,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mEditText.setText("@" + user.screen_name + " ");
|
||||
final int selection_end = mEditText.length();
|
||||
mEditText.setSelection(selection_end);
|
||||
mAccountsAdapter.setSelectedAccounts(user.account_id);
|
||||
mAccountsAdapter.setSelectedAccountIds(user.account_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -814,7 +831,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (status == null || status.id <= 0) return false;
|
||||
mEditText.setText(getQuoteStatus(this, status.user_screen_name, status.text_plain));
|
||||
mEditText.setSelection(0);
|
||||
mAccountsAdapter.setSelectedAccounts(status.account_id);
|
||||
mAccountsAdapter.setSelectedAccountIds(status.account_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -827,7 +844,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (!isEmpty(status.retweeted_by_screen_name)) {
|
||||
mEditText.append("@" + status.retweeted_by_screen_name + " ");
|
||||
}
|
||||
final Collection<String> mentions = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Collection<String> mentions = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
mentions.addAll(mExtractor.extractMentionedScreennames(status.text_plain));
|
||||
for (final String mention : mentions) {
|
||||
if (mention.equalsIgnoreCase(status.user_screen_name) || mention.equalsIgnoreCase(myScreenName)
|
||||
|
@ -838,7 +855,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
final int selectionEnd = mEditText.length();
|
||||
mEditText.setSelection(selectionStart, selectionEnd);
|
||||
mAccountsAdapter.setSelectedAccounts(status.account_id);
|
||||
mAccountsAdapter.setSelectedAccountIds(status.account_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -854,7 +871,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mEditText.append("@" + screenName + " ");
|
||||
}
|
||||
mEditText.setSelection(mEditText.length());
|
||||
mAccountsAdapter.setSelectedAccounts(accountId);
|
||||
mAccountsAdapter.setSelectedAccountIds(accountId);
|
||||
mInReplyToStatusId = inReplyToStatusId;
|
||||
return true;
|
||||
}
|
||||
|
@ -908,7 +925,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
private void saveAccountSelection() {
|
||||
if (!mShouldSaveAccounts) return;
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(KEY_COMPOSE_ACCOUNTS, TwidereArrayUtils.toString(mAccountsAdapter.getSelectedAccounts(), ',', false));
|
||||
editor.putString(KEY_COMPOSE_ACCOUNTS, TwidereArrayUtils.toString(mAccountsAdapter.getSelectedAccountIds(), ',', false));
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
|
@ -953,12 +970,12 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
final int menuHighlight = ThemeUtils.getUserAccentColor(this);
|
||||
if (attachLocation && getLocation()) {
|
||||
itemAttachLocation.setChecked(true);
|
||||
MenuUtils.setMenuInfo(itemAttachLocation, new TwidereMenuInfo(true, menuHighlight));
|
||||
ActionIconDrawable.setMenuHighlight(itemAttachLocation, new TwidereMenuInfo(true, menuHighlight));
|
||||
} else {
|
||||
setProgressVisibility(false);
|
||||
mPreferences.edit().putBoolean(KEY_ATTACH_LOCATION, false).apply();
|
||||
itemAttachLocation.setChecked(false);
|
||||
MenuUtils.setMenuInfo(itemAttachLocation, new TwidereMenuInfo(false, menuHighlight));
|
||||
ActionIconDrawable.setMenuHighlight(itemAttachLocation, new TwidereMenuInfo(false, menuHighlight));
|
||||
}
|
||||
}
|
||||
final MenuItem viewItem = menu.findItem(MENU_VIEW);
|
||||
|
@ -986,7 +1003,8 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (itemToggleSensitive != null) {
|
||||
itemToggleSensitive.setChecked(hasMedia && mIsPossiblySensitive);
|
||||
}
|
||||
mMenuBar.show();
|
||||
ThemeUtils.resetCheatSheet(mMenuBar);
|
||||
// mMenuBar.show();
|
||||
}
|
||||
|
||||
private void setProgressVisibility(final boolean visible) {
|
||||
|
@ -1040,7 +1058,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
mRecentLocation = location != null ? new ParcelableLocation(location) : null;
|
||||
}
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccounts();
|
||||
final long[] accountIds = mAccountsAdapter.getSelectedAccountIds();
|
||||
final boolean isQuote = INTENT_ACTION_QUOTE.equals(getIntent().getAction());
|
||||
final ParcelableLocation statusLocation = attach_location ? mRecentLocation : null;
|
||||
final boolean linkToQuotedTweet = mPreferences.getBoolean(KEY_LINK_TO_QUOTED_TWEET, true);
|
||||
|
@ -1094,7 +1112,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
|
||||
public void showAccount(AccountIconsAdapter adapter, ParcelableAccount account, boolean isSelected) {
|
||||
itemView.setAlpha(isSelected ? 1 : 0.7f);
|
||||
itemView.setAlpha(isSelected ? 1 : 0.33f);
|
||||
final ImageLoaderWrapper loader = adapter.getImageLoader();
|
||||
loader.displayProfileImage(iconView, account.profile_image_url);
|
||||
iconView.setBorderColor(account.color);
|
||||
|
@ -1110,15 +1128,17 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
private static class AccountIconsAdapter extends Adapter<AccountIconViewHolder> {
|
||||
|
||||
private final ComposeActivity mActivity;
|
||||
private final LayoutInflater mInflater;
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final LongSparseArray<Boolean> mSelection;
|
||||
|
||||
private ParcelableAccount[] mAccounts;
|
||||
|
||||
public AccountIconsAdapter(Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
public AccountIconsAdapter(ComposeActivity activity) {
|
||||
mActivity = activity;
|
||||
mInflater = LayoutInflater.from(activity);
|
||||
mImageLoader = TwidereApplication.getInstance(activity).getImageLoaderWrapper();
|
||||
mSelection = new LongSparseArray<>();
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1147,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public long[] getSelectedAccounts() {
|
||||
public long[] getSelectedAccountIds() {
|
||||
if (mAccounts == null) return new long[0];
|
||||
final long[] temp = new long[mAccounts.length];
|
||||
int selectedCount = 0;
|
||||
|
@ -1141,7 +1161,22 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
return result;
|
||||
}
|
||||
|
||||
public void setSelectedAccounts(long... accountIds) {
|
||||
@NonNull
|
||||
public ParcelableAccount[] getSelectedAccounts() {
|
||||
if (mAccounts == null) return new ParcelableAccount[0];
|
||||
final ParcelableAccount[] temp = new ParcelableAccount[mAccounts.length];
|
||||
int selectedCount = 0;
|
||||
for (ParcelableAccount account : mAccounts) {
|
||||
if (mSelection.get(account.account_id, false)) {
|
||||
temp[selectedCount++] = account;
|
||||
}
|
||||
}
|
||||
final ParcelableAccount[] result = new ParcelableAccount[selectedCount];
|
||||
System.arraycopy(temp, 0, result, 0, result.length);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setSelectedAccountIds(long... accountIds) {
|
||||
mSelection.clear();
|
||||
if (accountIds != null) {
|
||||
for (long accountId : accountIds) {
|
||||
|
@ -1178,10 +1213,15 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (mAccounts == null) return;
|
||||
final long accountId = mAccounts[position].account_id;
|
||||
mSelection.put(accountId, !mSelection.get(accountId, false));
|
||||
mActivity.notifyAccountSelectionChanged();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyAccountSelectionChanged() {
|
||||
mAccountActionProvider.setSelectedAccounts(mAccountsAdapter.getSelectedAccounts());
|
||||
}
|
||||
|
||||
private static class AddBitmapTask extends AddMediaTask {
|
||||
|
||||
private final Bitmap mBitmap;
|
||||
|
@ -1417,11 +1457,11 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) {
|
||||
final int pos = parent.getChildPosition(view);
|
||||
if (pos == 0) {
|
||||
outRect.set(mSpacingSmall, mSpacingSmall, mSpacingSmall, mSpacingExtraSmall);
|
||||
outRect.set(0, mSpacingSmall, 0, mSpacingExtraSmall);
|
||||
} else if (pos == parent.getAdapter().getItemCount() - 1) {
|
||||
outRect.set(mSpacingSmall, mSpacingExtraSmall, mSpacingSmall, mSpacingSmall);
|
||||
outRect.set(0, mSpacingExtraSmall, 0, mSpacingSmall);
|
||||
} else {
|
||||
outRect.set(mSpacingSmall, mSpacingExtraSmall, mSpacingSmall, mSpacingExtraSmall);
|
||||
outRect.set(0, mSpacingExtraSmall, 0, mSpacingExtraSmall);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1467,7 +1507,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
final int profileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
final int mediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null));
|
||||
mHolder.displayStatus(activity, loader, handler, twitter, profileImageStyle,
|
||||
mediaPreviewStyle, status, null, true);
|
||||
mediaPreviewStyle, true, status, null, true);
|
||||
mStatusContainer.findViewById(R.id.item_menu).setVisibility(View.GONE);
|
||||
mStatusContainer.findViewById(R.id.action_buttons).setVisibility(View.GONE);
|
||||
mStatusContainer.findViewById(R.id.reply_retweet_status).setVisibility(View.GONE);
|
||||
|
|
|
@ -50,7 +50,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.PopupMenu;
|
||||
import org.mariotaku.querybuilder.Columns.Column;
|
||||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.querybuilder.RawItemArray;
|
||||
|
@ -81,7 +80,6 @@ public class DraftsActivity extends BaseSupportActivity implements LoaderCallbac
|
|||
private DraftsAdapter mAdapter;
|
||||
private ListView mListView;
|
||||
|
||||
private PopupMenu mPopupMenu;
|
||||
|
||||
private float mTextSize;
|
||||
|
||||
|
@ -226,9 +224,6 @@ public class DraftsActivity extends BaseSupportActivity implements LoaderCallbac
|
|||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (mPopupMenu != null) {
|
||||
mPopupMenu.dismiss();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.mariotaku.twidere.activity.support;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.SearchManager;
|
||||
|
@ -42,8 +41,10 @@ import android.support.annotation.NonNull;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.view.ViewPager.OnPageChangeListener;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -87,6 +88,7 @@ import org.mariotaku.twidere.task.TwidereAsyncTask;
|
|||
import org.mariotaku.twidere.util.ActivityAccessor;
|
||||
import org.mariotaku.twidere.util.ActivityAccessor.TaskDescriptionCompat;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.ColorUtils;
|
||||
import org.mariotaku.twidere.util.FlymeUtils;
|
||||
import org.mariotaku.twidere.util.HotKeyHandler;
|
||||
import org.mariotaku.twidere.util.MathUtils;
|
||||
|
@ -160,6 +162,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
|
||||
private int mTabDisplayOption;
|
||||
private float mPagerPosition;
|
||||
private Toolbar mActionBar;
|
||||
|
||||
public void closeAccountsDrawer() {
|
||||
if (mSlidingMenu == null) return;
|
||||
|
@ -242,8 +245,10 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mActionBar = (Toolbar) findViewById(R.id.actionbar);
|
||||
mTabIndicator = (TabPagerIndicator) findViewById(R.id.main_tabs);
|
||||
mSlidingMenu = (HomeSlidingMenu) findViewById(R.id.home_menu);
|
||||
mViewPager = (ExtendedViewPager) findViewById(R.id.main_pager);
|
||||
mEmptyTabHint = findViewById(R.id.empty_tab_hint);
|
||||
|
@ -258,7 +263,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_home, menu);
|
||||
final MenuItem itemProgress = menu.findItem(MENU_PROGRESS);
|
||||
mSmartBarProgress = (ProgressBar) itemProgress.getActionView().findViewById(android.R.id.progress);
|
||||
mSmartBarProgress = (ProgressBar) MenuItemCompat.getActionView(itemProgress).findViewById(android.R.id.progress);
|
||||
updateActionsButton();
|
||||
return true;
|
||||
}
|
||||
|
@ -396,11 +401,15 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
|
||||
@Override
|
||||
public boolean onSearchRequested() {
|
||||
final Bundle appSearchData = new Bundle();
|
||||
if (mSelectedAccountToSearch != null) {
|
||||
appSearchData.putLong(EXTRA_ACCOUNT_ID, mSelectedAccountToSearch.account_id);
|
||||
}
|
||||
startSearch(null, false, appSearchData, false);
|
||||
// final Bundle appSearchData = new Bundle();
|
||||
// if (mSelectedAccountToSearch != null) {
|
||||
// appSearchData.putLong(EXTRA_ACCOUNT_ID, mSelectedAccountToSearch.account_id);
|
||||
// openSearch(this, mSelectedAccountToSearch.accountId, query);
|
||||
// }
|
||||
// startSearch(null, false, appSearchData, false);
|
||||
final Intent intent = new Intent(this, QuickSearchBarActivity.class);
|
||||
// intent.putExtra(EXTRA_ACCOUNT_ID, account.account_id);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -475,6 +484,11 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThemeResourceId() {
|
||||
return ThemeUtils.getNoActionBarThemeResource(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the context is first created.
|
||||
*/
|
||||
|
@ -485,9 +499,6 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
}
|
||||
window.requestFeature(Window.FEATURE_NO_TITLE);
|
||||
window.requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
|
||||
window.requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isDatabaseReady(this)) {
|
||||
Toast.makeText(this, R.string.preparing_database_toast, Toast.LENGTH_SHORT).show();
|
||||
|
@ -515,11 +526,8 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
}
|
||||
setContentView(R.layout.activity_home);
|
||||
setSupportActionBar(mActionBar);
|
||||
sendBroadcast(new Intent(BROADCAST_HOME_ACTIVITY_ONCREATE));
|
||||
final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false);
|
||||
mTabDisplayOption = getTabDisplayOptionInt(this);
|
||||
|
@ -568,8 +576,8 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
final IHomeActionButton homeActionButton = (IHomeActionButton) mActionsButton;
|
||||
mTabIndicator.setItemContext(ThemeUtils.getActionBarContext(this));
|
||||
if (ThemeUtils.isColoredActionBar(themeResId)) {
|
||||
final int contrastColor = Utils.getContrastYIQ(themeColor, 192);
|
||||
ViewAccessor.setBackground(mTabIndicator, new ColorDrawable(themeColor));
|
||||
final int contrastColor = ColorUtils.getContrastYIQ(themeColor, 192);
|
||||
ViewAccessor.setBackground(mActionBar, new ColorDrawable(themeColor));
|
||||
homeActionButton.setButtonColor(themeColor);
|
||||
homeActionButton.setIconColor(contrastColor, Mode.SRC_ATOP);
|
||||
mTabIndicator.setStripColor(contrastColor);
|
||||
|
@ -582,7 +590,7 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
} else {
|
||||
final int backgroundColor = ThemeUtils.getThemeBackgroundColor(mTabIndicator.getItemContext());
|
||||
final int foregroundColor = ThemeUtils.getThemeForegroundColor(mTabIndicator.getItemContext());
|
||||
ViewAccessor.setBackground(mTabIndicator, ThemeUtils.getActionBarBackground(this, themeResId));
|
||||
ViewAccessor.setBackground(mActionBar, ThemeUtils.getActionBarBackground(this, themeResId));
|
||||
homeActionButton.setButtonColor(backgroundColor);
|
||||
homeActionButton.setIconColor(foregroundColor, Mode.SRC_ATOP);
|
||||
mTabIndicator.setStripColor(themeColor);
|
||||
|
|
|
@ -35,9 +35,6 @@ import com.diegocarloslima.byakugallery.lib.TileBitmapDrawable;
|
|||
import com.diegocarloslima.byakugallery.lib.TileBitmapDrawable.OnInitializeListener;
|
||||
import com.diegocarloslima.byakugallery.lib.TouchImageView;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.MenuBar;
|
||||
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarListener;
|
||||
import org.mariotaku.tileimageview.widget.TileImageView;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.loader.support.TileImageLoader;
|
||||
|
@ -49,14 +46,13 @@ import java.io.File;
|
|||
|
||||
public final class MediaViewerActivity extends BaseSupportActivity implements Constants,
|
||||
TileImageLoader.DownloadListener, LoaderManager.LoaderCallbacks<TileImageLoader.Result>,
|
||||
OnMenuVisibilityListener, MenuBarListener {
|
||||
OnMenuVisibilityListener {
|
||||
|
||||
|
||||
private ActionBar mActionBar;
|
||||
|
||||
private ProgressBar mProgress;
|
||||
private TouchImageView mImageView;
|
||||
private MenuBar mMenuBar;
|
||||
|
||||
private long mContentLength;
|
||||
|
||||
|
@ -70,11 +66,10 @@ public final class MediaViewerActivity extends BaseSupportActivity implements Co
|
|||
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mImageView = (TouchImageView) findViewById(R.id.image_viewer);
|
||||
mProgress = (ProgressBar) findViewById(R.id.progress);
|
||||
mMenuBar = (MenuBar) findViewById(R.id.menu_bar);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +145,7 @@ public final class MediaViewerActivity extends BaseSupportActivity implements Co
|
|||
updateShareIntent();
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Override
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_SAVE: {
|
||||
|
@ -252,10 +247,6 @@ public final class MediaViewerActivity extends BaseSupportActivity implements Co
|
|||
mImageView.setMaxScale(2);
|
||||
|
||||
|
||||
mMenuBar.setMenuBarListener(this);
|
||||
mMenuBar.inflate(R.menu.menu_image_viewer);
|
||||
mMenuBar.setIsBottomBar(true);
|
||||
mMenuBar.show();
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,31 +298,21 @@ public final class MediaViewerActivity extends BaseSupportActivity implements Co
|
|||
|
||||
|
||||
void updateShareIntent() {
|
||||
final MenuItem item = mMenuBar.getMenu().findItem(MENU_SHARE);
|
||||
if (item == null || !item.hasSubMenu()) return;
|
||||
final SubMenu subMenu = item.getSubMenu();
|
||||
subMenu.clear();
|
||||
final Intent intent = getIntent();
|
||||
final Uri uri = intent.getData();
|
||||
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
if (mImageFile != null && mImageFile.exists()) {
|
||||
shareIntent.setType("image/*");
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mImageFile));
|
||||
} else {
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, uri.toString());
|
||||
}
|
||||
Utils.addIntentToMenu(this, subMenu, shareIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreShowMenu(Menu menu) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostShowMenu(Menu menu) {
|
||||
|
||||
// final MenuItem item = mMenuBar.getMenu().findItem(MENU_SHARE);
|
||||
// if (item == null || !item.hasSubMenu()) return;
|
||||
// final SubMenu subMenu = item.getSubMenu();
|
||||
// subMenu.clear();
|
||||
// final Intent intent = getIntent();
|
||||
// final Uri uri = intent.getData();
|
||||
// final Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
// if (mImageFile != null && mImageFile.exists()) {
|
||||
// shareIntent.setType("image/*");
|
||||
// shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mImageFile));
|
||||
// } else {
|
||||
// shareIntent.setType("text/plain");
|
||||
// shareIntent.putExtra(Intent.EXTRA_TEXT, uri.toString());
|
||||
// }
|
||||
// Utils.addIntentToMenu(this, subMenu, shareIntent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
package org.mariotaku.twidere.activity.support;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuAdapter;
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
public abstract class MenuDialogFragment extends BaseSupportDialogFragment implements OnItemClickListener {
|
||||
|
||||
private MenuAdapter mAdapter;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Context context = getThemedContext();
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
mAdapter = new MenuAdapter(context);
|
||||
final ListView listView = new ListView(context);
|
||||
listView.setAdapter(mAdapter);
|
||||
listView.setOnItemClickListener(this);
|
||||
builder.setView(listView);
|
||||
final Menu menu = MenuUtils.createMenu(context);
|
||||
onCreateMenu(new MenuInflater(context), menu);
|
||||
final int itemColor = ThemeUtils.getThemeForegroundColor(context);
|
||||
final int highlightColor = ThemeUtils.getUserAccentColor(context);
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, highlightColor, Mode.SRC_ATOP);
|
||||
mAdapter.setMenu(menu);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public Context getThemedContext() {
|
||||
return getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final Fragment parentFragment = getParentFragment();
|
||||
final MenuItem item = (MenuItem) parent.getItemAtPosition(position);
|
||||
if (item.hasSubMenu()) {
|
||||
mAdapter.setMenu(item.getSubMenu());
|
||||
} else if (parentFragment instanceof OnMenuItemClickListener) {
|
||||
((OnMenuItemClickListener) parentFragment).onMenuItemClick(item);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void onCreateMenu(MenuInflater inflater, Menu menu);
|
||||
|
||||
}
|
|
@ -66,8 +66,8 @@ public class RequestPermissionsActivity extends BaseSupportDialogActivity implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mIconView = (ImageView) findViewById(android.R.id.icon);
|
||||
mNameView = (TextView) findViewById(android.R.id.text1);
|
||||
mDescriptionView = (TextView) findViewById(android.R.id.text2);
|
||||
|
|
|
@ -181,8 +181,8 @@ public class SignInActivity extends BaseSupportActivity implements TwitterConsta
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mEditUsername = (EditText) findViewById(R.id.username);
|
||||
mEditPassword = (EditText) findViewById(R.id.password);
|
||||
mSignInButton = (Button) findViewById(R.id.sign_in);
|
||||
|
|
|
@ -23,8 +23,8 @@ import android.content.Context;
|
|||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
|
@ -33,6 +33,7 @@ import android.view.View;
|
|||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.util.ColorUtils;
|
||||
import org.mariotaku.twidere.util.StrictModeUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
@ -41,7 +42,7 @@ import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
|
|||
|
||||
import static org.mariotaku.twidere.util.Utils.restartActivity;
|
||||
|
||||
public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants, IThemedActivity {
|
||||
public abstract class ThemedFragmentActivity extends ActionBarActivity implements Constants, IThemedActivity {
|
||||
|
||||
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
|
||||
@ShapeStyle
|
||||
|
@ -106,7 +107,7 @@ public abstract class ThemedFragmentActivity extends FragmentActivity implements
|
|||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
final SpannableStringBuilder builder = new SpannableStringBuilder(title);
|
||||
final int themeResId = getCurrentThemeResourceId();
|
||||
final int themeColor = getThemeColor(), contrastColor = Utils.getContrastYIQ(themeColor, 192);
|
||||
final int themeColor = getThemeColor(), contrastColor = ColorUtils.getContrastYIQ(themeColor, 192);
|
||||
if (!ThemeUtils.isDarkTheme(themeResId)) {
|
||||
builder.setSpan(new ForegroundColorSpan(contrastColor), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
|
|
@ -101,8 +101,8 @@ public class UserListSelectorActivity extends BaseSupportDialogActivity implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mUsersListContainer = findViewById(R.id.users_list_container);
|
||||
mUserListsContainer = findViewById(R.id.user_lists_container);
|
||||
mEditScreenName = (AutoCompleteTextView) findViewById(R.id.edit_screen_name);
|
||||
|
|
|
@ -185,8 +185,8 @@ public class UserProfileEditorActivity extends BaseSupportActivity implements On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
super.onContentChanged();
|
||||
public void onSupportContentChanged() {
|
||||
super.onSupportContentChanged();
|
||||
mProgressContainer = findViewById(R.id.progress_container);
|
||||
mContent = findViewById(R.id.content);
|
||||
mProfileBannerView = (ImageView) findViewById(R.id.profile_banner);
|
||||
|
|
|
@ -196,9 +196,9 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
status = activity.target_statuses[0];
|
||||
}
|
||||
final StatusViewHolder statusViewHolder = (StatusViewHolder) holder;
|
||||
statusViewHolder.displayStatus(getContext(), getImageLoader(),
|
||||
getImageLoadingHandler(), getTwitterWrapper(),
|
||||
getProfileImageStyle(), getMediaPreviewStyle(), status, null, false);
|
||||
statusViewHolder.displayStatus(getContext(), getImageLoader(), getImageLoadingHandler(),
|
||||
getTwitterWrapper(), getProfileImageStyle(), getMediaPreviewStyle(), false,
|
||||
status, null, false);
|
||||
break;
|
||||
}
|
||||
case ITEM_VIEW_TYPE_TITLE_SUMMARY: {
|
||||
|
|
|
@ -49,6 +49,7 @@ public abstract class AbsStatusesAdapter<D> extends Adapter<ViewHolder> implemen
|
|||
private boolean mLoadMoreIndicatorEnabled;
|
||||
private StatusAdapterListener mStatusAdapterListener;
|
||||
private boolean mShowInReplyTo;
|
||||
private boolean mShowAccountsColor;
|
||||
|
||||
public AbsStatusesAdapter(Context context, boolean compact) {
|
||||
mContext = context;
|
||||
|
@ -165,6 +166,17 @@ public abstract class AbsStatusesAdapter<D> extends Adapter<ViewHolder> implemen
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowAccountsColor() {
|
||||
return mShowAccountsColor;
|
||||
}
|
||||
|
||||
public void setShowAccountsColor(boolean showAccountsColor) {
|
||||
if (mShowAccountsColor == showAccountsColor) return;
|
||||
mShowAccountsColor = showAccountsColor;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getStatusCount()) {
|
||||
|
|
|
@ -16,4 +16,5 @@ public interface IStatusesAdapter<Data> extends IContentCardAdapter, StatusClick
|
|||
|
||||
void setData(Data data);
|
||||
|
||||
boolean shouldShowAccountsColor();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ import com.mobeta.android.dslv.DragSortListView;
|
|||
import com.mobeta.android.dslv.DragSortListView.DropListener;
|
||||
import com.mobeta.android.dslv.SimpleDragSortCursorAdapter;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.PopupMenu;
|
||||
import org.mariotaku.querybuilder.Columns.Column;
|
||||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.querybuilder.RawItemArray;
|
||||
|
@ -84,8 +83,6 @@ public class CustomTabsFragment extends BaseListFragment implements LoaderCallba
|
|||
|
||||
private DragSortListView mListView;
|
||||
|
||||
private PopupMenu mPopupMenu;
|
||||
|
||||
private CustomTabsAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
|
@ -281,9 +278,6 @@ public class CustomTabsFragment extends BaseListFragment implements LoaderCallba
|
|||
|
||||
@Override
|
||||
public void onStop() {
|
||||
if (mPopupMenu != null) {
|
||||
mPopupMenu.dismiss();
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,10 @@ import android.support.v4.content.Loader;
|
|||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.OnScrollListener;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -21,7 +22,6 @@ import android.view.ViewGroup;
|
|||
import com.squareup.otto.Bus;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.PopupMenu;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.AbsStatusesAdapter;
|
||||
import org.mariotaku.twidere.adapter.AbsStatusesAdapter.StatusAdapterListener;
|
||||
|
@ -142,7 +142,6 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
|
|||
public final Loader<Data> onCreateLoader(int id, Bundle args) {
|
||||
final boolean fromUser = args.getBoolean(EXTRA_FROM_USER);
|
||||
args.remove(EXTRA_FROM_USER);
|
||||
Log.d(LOGTAG, String.format("Creating loader for %s, fromUser: %b", getClass(), fromUser));
|
||||
return onCreateStatusesLoader(getActivity(), args, fromUser);
|
||||
}
|
||||
|
||||
|
@ -218,7 +217,9 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
|
|||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setOnScrollListener(mOnScrollListener);
|
||||
mAdapter.setListener(this);
|
||||
getLoaderManager().initLoader(0, getArguments(), this);
|
||||
final Bundle loaderArgs = new Bundle(getArguments());
|
||||
loaderArgs.putBoolean(EXTRA_FROM_USER, true);
|
||||
getLoaderManager().initLoader(0, loaderArgs, this);
|
||||
setListShown(false);
|
||||
}
|
||||
|
||||
|
@ -294,7 +295,8 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
|
|||
if (mPopupMenu != null) {
|
||||
mPopupMenu.dismiss();
|
||||
}
|
||||
final PopupMenu popupMenu = PopupMenu.getInstance(mAdapter.getContext(), menuView);
|
||||
final PopupMenu popupMenu = new PopupMenu(mAdapter.getContext(), menuView,
|
||||
Gravity.NO_GRAVITY, R.attr.actionOverflowMenuStyle, 0);
|
||||
popupMenu.inflate(R.menu.action_status);
|
||||
setMenuForStatus(mAdapter.getContext(), popupMenu.getMenu(), mAdapter.getStatus(position));
|
||||
popupMenu.show();
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.ActivityNotFoundException;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.util.Log;
|
||||
|
@ -215,10 +214,6 @@ abstract class BaseUserListsListFragment extends BasePullToRefreshListFragment i
|
|||
public void onScrollStateChanged(final AbsListView view, final int scrollState) {
|
||||
}
|
||||
|
||||
protected UserListMenuDialogFragment createMenuDialog() {
|
||||
return new UserListMenuDialogFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReachedBottom() {
|
||||
if (!mLoadMoreAutomatically) return;
|
||||
|
@ -227,13 +222,7 @@ abstract class BaseUserListsListFragment extends BasePullToRefreshListFragment i
|
|||
|
||||
private void showMenu(final View view, final ParcelableUserList userList) {
|
||||
mSelectedUserList = userList;
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (activity == null || activity.isFinishing() || view == null || userList == null) return;
|
||||
final UserListMenuDialogFragment df = createMenuDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(EXTRA_USER_LIST, userList);
|
||||
df.setArguments(args);
|
||||
df.show(getChildFragmentManager(), "user_list_menu");
|
||||
//TODO show menu
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.content.ActivityNotFoundException;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.util.Log;
|
||||
|
@ -246,9 +245,6 @@ abstract class BaseUsersListFragment extends BasePullToRefreshListFragment imple
|
|||
super.onStop();
|
||||
}
|
||||
|
||||
protected UserMenuDialogFragment createMenuDialog() {
|
||||
return new UserMenuDialogFragment();
|
||||
}
|
||||
|
||||
protected ParcelableUser getSelectedUser() {
|
||||
return mSelectedUser;
|
||||
|
@ -283,12 +279,6 @@ abstract class BaseUsersListFragment extends BasePullToRefreshListFragment imple
|
|||
|
||||
private void showMenu(final View view, final ParcelableUser user) {
|
||||
mSelectedUser = user;
|
||||
final FragmentActivity activity = getActivity();
|
||||
if (activity == null || activity.isFinishing() || view == null || user == null) return;
|
||||
final UserMenuDialogFragment df = createMenuDialog();
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(EXTRA_USER, user);
|
||||
df.setArguments(args);
|
||||
df.show(getChildFragmentManager(), "user_menu");
|
||||
//TODO show menu
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ public abstract class CursorStatusesFragment extends AbsStatusesFragment<Cursor>
|
|||
where = accountWhere;
|
||||
}
|
||||
final String selection = processWhere(where).getSQL();
|
||||
getAdapter().setShowAccountsColor(accountIds.length > 1);
|
||||
return new ExtendedCursorLoader(context, uri, Statuses.COLUMNS, selection, null, sortOrder, fromUser);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
|||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -42,7 +43,6 @@ import android.view.LayoutInflater;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -60,7 +60,6 @@ import android.widget.TextView.OnEditorActionListener;
|
|||
import com.squareup.otto.Bus;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.PopupMenu;
|
||||
import org.mariotaku.querybuilder.Columns.Column;
|
||||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.querybuilder.OrderBy;
|
||||
|
@ -102,8 +101,8 @@ import static org.mariotaku.twidere.util.Utils.configBaseCardAdapter;
|
|||
import static org.mariotaku.twidere.util.Utils.showOkMessage;
|
||||
|
||||
public class DirectMessagesConversationFragment extends BaseSupportFragment implements
|
||||
LoaderCallbacks<Cursor>, OnMenuItemClickListener, TextWatcher, OnClickListener,
|
||||
OnItemSelectedListener, OnEditorActionListener, MenuButtonClickListener {
|
||||
LoaderCallbacks<Cursor>, TextWatcher, OnClickListener, OnItemSelectedListener,
|
||||
OnEditorActionListener, MenuButtonClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
|
||||
private static final int LOADER_ID_SEARCH_USERS = 1;
|
||||
|
||||
|
@ -694,11 +693,11 @@ public class DirectMessagesConversationFragment extends BaseSupportFragment impl
|
|||
}
|
||||
|
||||
private void showMenu(final View view, final ParcelableDirectMessage dm) {
|
||||
if (mPopupMenu != null && mPopupMenu.isShowing()) {
|
||||
if (mPopupMenu != null) {
|
||||
mPopupMenu.dismiss();
|
||||
}
|
||||
final Context context = getActivity();
|
||||
mPopupMenu = PopupMenu.getInstance(context, view);
|
||||
mPopupMenu = new PopupMenu(context, view);
|
||||
mPopupMenu.inflate(R.menu.action_direct_message);
|
||||
final Menu menu = mPopupMenu.getMenu();
|
||||
final MenuItem view_profile_item = menu.findItem(MENU_VIEW_PROFILE);
|
||||
|
|
|
@ -30,37 +30,32 @@ import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
|||
|
||||
public class IncomingFriendshipsFragment extends CursorSupportUsersListFragment {
|
||||
|
||||
@Override
|
||||
public IDsUsersLoader newLoaderInstance(final Context context, final Bundle args) {
|
||||
if (args == null) return null;
|
||||
final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
|
||||
return new IncomingFriendshipsLoader(context, accountId, getNextCursor(), getData());
|
||||
}
|
||||
@Override
|
||||
public IDsUsersLoader newLoaderInstance(final Context context, final Bundle args) {
|
||||
if (args == null) return null;
|
||||
final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
|
||||
return new IncomingFriendshipsLoader(context, accountId, getNextCursor(), getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ACCEPT: {
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final ParcelableUser user = getSelectedUser();
|
||||
if (twitter == null || user == null) return false;
|
||||
twitter.acceptFriendshipAsync(user.account_id, user.id);
|
||||
break;
|
||||
}
|
||||
case MENU_DENY: {
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final ParcelableUser user = getSelectedUser();
|
||||
if (twitter == null || user == null) return false;
|
||||
twitter.denyFriendshipAsync(user.account_id, user.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onMenuItemClick(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserMenuDialogFragment createMenuDialog() {
|
||||
return new IncomingFriendshipsMenuDialogFragment();
|
||||
}
|
||||
@Override
|
||||
public boolean onMenuItemClick(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ACCEPT: {
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final ParcelableUser user = getSelectedUser();
|
||||
if (twitter == null || user == null) return false;
|
||||
twitter.acceptFriendshipAsync(user.account_id, user.id);
|
||||
break;
|
||||
}
|
||||
case MENU_DENY: {
|
||||
final AsyncTwitterWrapper twitter = getTwitterWrapper();
|
||||
final ParcelableUser user = getSelectedUser();
|
||||
if (twitter == null || user == null) return false;
|
||||
twitter.denyFriendshipAsync(user.account_id, user.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onMenuItemClick(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount.ParcelableCredentials;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
public class IncomingFriendshipsMenuDialogFragment extends UserMenuDialogFragment {
|
||||
|
||||
@Override
|
||||
protected void onPrepareItemMenu(final Menu menu, final ParcelableUser user) {
|
||||
final Context context = getThemedContext();
|
||||
final ParcelableCredentials account = ParcelableAccount.getCredentials(context, user.account_id);
|
||||
if (Utils.isOfficialCredentials(context, account)) {
|
||||
final MenuInflater inflater = new MenuInflater(context);
|
||||
inflater.inflate(R.menu.action_incoming_friendship, menu);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -101,7 +101,7 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
|
|||
|
||||
|
||||
holder.displayStatus(context, loader, handler, twitter, profileImageStyle, mediaPreviewStyle,
|
||||
getStatus(), null, true);
|
||||
true, getStatus(), null, true);
|
||||
view.findViewById(R.id.item_menu).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.action_buttons).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.reply_retweet_status).setVisibility(View.GONE);
|
||||
|
|
|
@ -38,6 +38,7 @@ import android.support.v4.app.FragmentTransaction;
|
|||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -49,8 +50,8 @@ import android.text.TextUtils;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -93,7 +94,6 @@ import org.mariotaku.twidere.util.Utils;
|
|||
import org.mariotaku.twidere.util.Utils.OnMediaClickListener;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
import org.mariotaku.twidere.view.StatusTextView;
|
||||
import org.mariotaku.twidere.view.TwidereMenuBar;
|
||||
import org.mariotaku.twidere.view.TwitterCardContainer;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder;
|
||||
|
@ -121,7 +121,6 @@ import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
|
|||
import static org.mariotaku.twidere.util.Utils.isMyRetweet;
|
||||
import static org.mariotaku.twidere.util.Utils.openStatus;
|
||||
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
||||
import static org.mariotaku.twidere.util.Utils.setMenuForStatus;
|
||||
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
||||
import static org.mariotaku.twidere.util.Utils.showOkMessage;
|
||||
import static org.mariotaku.twidere.util.Utils.startStatusShareChooser;
|
||||
|
@ -156,7 +155,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
final long maxId = args.getLong(EXTRA_MAX_ID, -1);
|
||||
final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
|
||||
final StatusRepliesLoader loader = new StatusRepliesLoader(getActivity(), accountId,
|
||||
screenName, statusId, maxId, sinceId, null, null, 0, false);
|
||||
screenName, statusId, maxId, sinceId, null, null, 0, true);
|
||||
loader.setComparator(ParcelableStatus.REVERSE_ID_COMPARATOR);
|
||||
return loader;
|
||||
}
|
||||
|
@ -272,11 +271,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
|
||||
@Override
|
||||
public void onStatusMenuClick(StatusViewHolder holder, View itemView, int position) {
|
||||
final Bundle args = new Bundle();
|
||||
args.putParcelable(EXTRA_STATUS, mStatusAdapter.getStatus(position));
|
||||
final StatusMenuDialogFragment f = new StatusMenuDialogFragment();
|
||||
f.setArguments(args);
|
||||
f.show(getActivity().getSupportFragmentManager(), "status_menu");
|
||||
//TODO show status menu
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -528,6 +523,11 @@ public class StatusFragment extends BaseSupportFragment
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowAccountsColor() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncTwitterWrapper getTwitterWrapper() {
|
||||
return mFragment.getTwitterWrapper();
|
||||
|
@ -814,13 +814,14 @@ public class StatusFragment extends BaseSupportFragment
|
|||
}
|
||||
}
|
||||
|
||||
private static class DetailStatusViewHolder extends ViewHolder implements OnClickListener, OnMenuItemClickListener {
|
||||
private static class DetailStatusViewHolder extends ViewHolder implements OnClickListener,
|
||||
ActionMenuView.OnMenuItemClickListener {
|
||||
|
||||
private final StatusAdapter adapter;
|
||||
|
||||
private final CardView cardView;
|
||||
|
||||
private final TwidereMenuBar menuBar;
|
||||
private final ActionMenuView menuBar;
|
||||
private final TextView nameView, screenNameView;
|
||||
private final StatusTextView textView;
|
||||
private final ShapedImageView profileImageView;
|
||||
|
@ -842,7 +843,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
super(itemView);
|
||||
this.adapter = adapter;
|
||||
cardView = (CardView) itemView.findViewById(R.id.card);
|
||||
menuBar = (TwidereMenuBar) itemView.findViewById(R.id.menu_bar);
|
||||
menuBar = (ActionMenuView) itemView.findViewById(R.id.menu_bar);
|
||||
nameView = (TextView) itemView.findViewById(R.id.name);
|
||||
screenNameView = (TextView) itemView.findViewById(R.id.screen_name);
|
||||
textView = (StatusTextView) itemView.findViewById(R.id.text);
|
||||
|
@ -1111,13 +1112,16 @@ public class StatusFragment extends BaseSupportFragment
|
|||
// final FragmentTransaction ft = fm.beginTransaction();
|
||||
}
|
||||
|
||||
setMenuForStatus(context, menuBar.getMenu(), status, adapter.getStatusAccount());
|
||||
menuBar.show();
|
||||
Utils.setMenuForStatus(context, menuBar.getMenu(), status, adapter.getStatusAccount());
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
// menuBar.setOnMenuItemClickListener(this);
|
||||
menuBar.setOnMenuItemClickListener(this);
|
||||
menuBar.inflate(R.menu.menu_status);
|
||||
final FragmentActivity activity = adapter.getFragment().getActivity();
|
||||
final MenuInflater inflater = activity.getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_status, menuBar.getMenu());
|
||||
ThemeUtils.wrapMenuIcon(menuBar, MENU_GROUP_STATUS_SHARE);
|
||||
mediaPreviewLoad.setOnClickListener(this);
|
||||
profileContainer.setOnClickListener(this);
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.support.MenuDialogFragment;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.setMenuForStatus;
|
||||
|
||||
public class StatusMenuDialogFragment extends MenuDialogFragment {
|
||||
|
||||
@Override
|
||||
protected void onCreateMenu(final MenuInflater inflater, final Menu menu) {
|
||||
inflater.inflate(R.menu.action_status, menu);
|
||||
final SharedPreferences prefs = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final Bundle args = getArguments();
|
||||
final ParcelableStatus status = args.getParcelable(EXTRA_STATUS);
|
||||
setMenuForStatus(getThemedContext(), menu, status);
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ public class StatusRepliesListFragment extends StatusesSearchFragment {
|
|||
@Override
|
||||
public Loader<List<ParcelableStatus>> onCreateStatusesLoader(final Context context,
|
||||
final Bundle args,
|
||||
final boolean fromUser) {
|
||||
final boolean fromUser) {
|
||||
final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
|
||||
final String screenName = args.getString(EXTRA_SCREEN_NAME);
|
||||
final long statusId = args.getLong(EXTRA_STATUS_ID, -1);
|
||||
|
|
|
@ -136,7 +136,7 @@ public class StatusTranslateDialogFragment extends BaseSupportDialogFragment imp
|
|||
final int profileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
final int mediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null));
|
||||
mHolder.displayStatus(activity, loader, handler, twitter, profileImageStyle,
|
||||
mediaPreviewStyle, status, null, true);
|
||||
mediaPreviewStyle, true, status, null, true);
|
||||
mStatusContainer.findViewById(R.id.item_menu).setVisibility(View.GONE);
|
||||
mStatusContainer.findViewById(R.id.action_buttons).setVisibility(View.GONE);
|
||||
mStatusContainer.findViewById(R.id.reply_retweet_status).setVisibility(View.GONE);
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ContentResolver;
|
||||
|
@ -38,6 +37,7 @@ import android.graphics.Paint;
|
|||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
|
@ -49,10 +49,12 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.app.SharedElementCallback;
|
||||
import android.support.v4.content.AsyncTaskLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
@ -76,7 +78,6 @@ import android.widget.TextView;
|
|||
import com.squareup.otto.Bus;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
|
@ -90,6 +91,7 @@ import org.mariotaku.twidere.app.TwidereApplication;
|
|||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
|
||||
import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
import org.mariotaku.twidere.loader.support.ParcelableUserLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount.ParcelableCredentials;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
|
@ -121,6 +123,7 @@ import org.mariotaku.twidere.view.TintedStatusFrameLayout;
|
|||
import org.mariotaku.twidere.view.iface.IColorLabelView;
|
||||
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import twitter4j.Relationship;
|
||||
|
@ -189,6 +192,9 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
private View mProfileBannerContainer;
|
||||
private Button mFollowButton;
|
||||
private ProgressBar mFollowProgress;
|
||||
private View mPagesContent, mPagesErrorContainer;
|
||||
private ImageView mPagesErrorIcon;
|
||||
private TextView mPagesErrorText;
|
||||
|
||||
private SupportTabsAdapter mPagerAdapter;
|
||||
|
||||
|
@ -323,7 +329,16 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
} else if (relationship != null) {
|
||||
final int drawableRes;
|
||||
mFollowButton.setEnabled(!relationship.isSourceBlockedByTarget());
|
||||
getView().findViewById(R.id.pages_error).setVisibility(relationship.isSourceBlockedByTarget() ? View.VISIBLE : View.GONE);
|
||||
if (relationship.isSourceBlockedByTarget()) {
|
||||
mPagesErrorContainer.setVisibility(View.VISIBLE);
|
||||
final String displayName = UserColorNameUtils.getDisplayName(getActivity(), user);
|
||||
mPagesErrorText.setText(getString(R.string.blocked_by_user_summary, displayName));
|
||||
mPagesContent.setVisibility(View.GONE);
|
||||
} else {
|
||||
mPagesErrorContainer.setVisibility(View.GONE);
|
||||
mPagesErrorText.setText(null);
|
||||
mPagesContent.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (relationship.isSourceBlockingTarget()) {
|
||||
mFollowButton.setText(R.string.unblock);
|
||||
drawableRes = R.drawable.ic_follow_blocked;
|
||||
|
@ -368,7 +383,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
} else {
|
||||
mFollowButton.setText(null);
|
||||
mFollowButton.setVisibility(View.GONE);
|
||||
getView().findViewById(R.id.pages_error).setVisibility(View.GONE);
|
||||
mPagesErrorContainer.setVisibility(View.GONE);
|
||||
mPagesContent.setVisibility(View.VISIBLE);
|
||||
// mFollowingYouIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
@ -403,32 +419,29 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
mProfileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
mScreenNameView.setText("@" + user.screen_name);
|
||||
mDescriptionContainer.setVisibility(userIsMe || !isEmpty(user.description_html) ? View.VISIBLE : View.GONE);
|
||||
mDescriptionView.setText(user.description_html != null ? Html.fromHtml(user.description_html) : null);
|
||||
mDescriptionContainer.setVisibility(isEmpty(user.description_html) ? View.GONE : View.VISIBLE);
|
||||
mDescriptionView.setText(user.description_html != null ? Html.fromHtml(user.description_html) : user.description_plain);
|
||||
final TwidereLinkify linkify = new TwidereLinkify(this);
|
||||
linkify.applyAllLinks(mDescriptionView, user.account_id, false);
|
||||
mDescriptionView.setMovementMethod(null);
|
||||
mLocationContainer.setVisibility(userIsMe || !isEmpty(user.location) ? View.VISIBLE : View.GONE);
|
||||
mLocationContainer.setVisibility(isEmpty(user.location) ? View.GONE : View.VISIBLE);
|
||||
mLocationView.setText(user.location);
|
||||
mURLContainer.setVisibility(userIsMe || !isEmpty(user.url) || !isEmpty(user.url_expanded) ? View.VISIBLE
|
||||
: View.GONE);
|
||||
mURLContainer.setVisibility(isEmpty(user.url) && isEmpty(user.url_expanded) ? View.GONE : View.VISIBLE);
|
||||
mURLView.setText(isEmpty(user.url_expanded) ? user.url : user.url_expanded);
|
||||
mURLView.setMovementMethod(null);
|
||||
final String createdAt = formatToLongTimeString(activity, user.created_at);
|
||||
final float daysSinceCreated = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24;
|
||||
final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreated));
|
||||
final float daysSinceCreation = (System.currentTimeMillis() - user.created_at) / 1000 / 60 / 60 / 24;
|
||||
final int dailyTweets = Math.round(user.statuses_count / Math.max(1, daysSinceCreation));
|
||||
mCreatedAtView.setText(res.getQuantityString(R.plurals.created_at_with_N_tweets_per_day, dailyTweets,
|
||||
createdAt, dailyTweets));
|
||||
mListedCount.setText(getLocalizedNumber(mLocale, user.listed_count));
|
||||
mFollowersCount.setText(getLocalizedNumber(mLocale, user.followers_count));
|
||||
mFriendsCount.setText(getLocalizedNumber(mLocale, user.friends_count));
|
||||
|
||||
mProfileImageLoader.displayProfileImage(mProfileImageView, getOriginalTwitterProfileImage(user.profile_image_url));
|
||||
if (userColor != 0) {
|
||||
mProfileImageLoader.displayProfileImage(mProfileImageView,
|
||||
getOriginalTwitterProfileImage(user.profile_image_url));
|
||||
setUserColor(userColor);
|
||||
} else {
|
||||
mProfileImageLoader.displayProfileImage(mProfileImageView,
|
||||
getOriginalTwitterProfileImage(user.profile_image_url));
|
||||
setUserColor(user.link_color);
|
||||
}
|
||||
final int defWidth = res.getDisplayMetrics().widthPixels;
|
||||
|
@ -597,9 +610,18 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_user, container, false);
|
||||
final View view = inflater.inflate(R.layout.fragment_user, container, false);
|
||||
final ViewGroup profileDetailsContainer = (ViewGroup) view.findViewById(R.id.profile_details_container);
|
||||
final boolean isCompact = Utils.isCompactCards(getActivity());
|
||||
if (isCompact) {
|
||||
inflater.inflate(R.layout.layout_user_details_compact, profileDetailsContainer);
|
||||
} else {
|
||||
inflater.inflate(R.layout.layout_user_details, profileDetailsContainer);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
@ -622,6 +644,44 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
mProfileImageLoader = getApplication().getImageLoaderWrapper();
|
||||
final FragmentActivity activity = getActivity();
|
||||
|
||||
activity.setEnterSharedElementCallback(new SharedElementCallback() {
|
||||
|
||||
@Override
|
||||
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
|
||||
int idx = sharedElementNames.indexOf(TRANSITION_NAME_PROFILE_IMAGE);
|
||||
if (idx != -1) {
|
||||
final View view = sharedElements.get(idx);
|
||||
int[] location = new int[2];
|
||||
final RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
|
||||
view.getLocationOnScreen(location);
|
||||
bounds.offsetTo(location[0], location[1]);
|
||||
mProfileImageView.setTransitionDestination(bounds);
|
||||
}
|
||||
super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateSnapshotView(Context context, Parcelable snapshot) {
|
||||
final View view = super.onCreateSnapshotView(context, snapshot);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
|
||||
final int idx = sharedElementNames.indexOf(TRANSITION_NAME_PROFILE_IMAGE);
|
||||
if (idx != -1) {
|
||||
final View view = sharedElements.get(idx);
|
||||
int[] location = new int[2];
|
||||
final RectF bounds = new RectF(0, 0, view.getWidth(), view.getHeight());
|
||||
view.getLocationOnScreen(location);
|
||||
bounds.offsetTo(location[0], location[1]);
|
||||
mProfileImageView.setTransitionSource(bounds);
|
||||
}
|
||||
super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ViewCompat.setTransitionName(mProfileImageView, TRANSITION_NAME_PROFILE_IMAGE);
|
||||
ViewCompat.setTransitionName(mProfileTypeView, TRANSITION_NAME_PROFILE_TYPE);
|
||||
ViewCompat.setTransitionName(mCardView, TRANSITION_NAME_CARD);
|
||||
|
@ -732,19 +792,19 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
final MenuItem blockItem = menu.findItem(MENU_BLOCK);
|
||||
if (blockItem != null) {
|
||||
final boolean blocking = relationship.isSourceBlockingTarget();
|
||||
MenuUtils.setMenuInfo(blockItem, new TwidereMenuInfo(blocking));
|
||||
ActionIconDrawable.setMenuHighlight(blockItem, new TwidereMenuInfo(blocking));
|
||||
blockItem.setTitle(blocking ? R.string.unblock : R.string.block);
|
||||
}
|
||||
final MenuItem muteItem = menu.findItem(MENU_MUTE_USER);
|
||||
if (muteItem != null) {
|
||||
final boolean muting = relationship.isSourceMutingTarget();
|
||||
MenuUtils.setMenuInfo(muteItem, new TwidereMenuInfo(muting));
|
||||
ActionIconDrawable.setMenuHighlight(muteItem, new TwidereMenuInfo(muting));
|
||||
muteItem.setTitle(muting ? R.string.unmute : R.string.mute);
|
||||
}
|
||||
final MenuItem filterItem = menu.findItem(MENU_ADD_TO_FILTER);
|
||||
if (filterItem != null) {
|
||||
final boolean filtering = Utils.isFilteringUser(getActivity(), user.id);
|
||||
MenuUtils.setMenuInfo(filterItem, new TwidereMenuInfo(filtering));
|
||||
ActionIconDrawable.setMenuHighlight(filterItem, new TwidereMenuInfo(filtering));
|
||||
filterItem.setTitle(filtering ? R.string.remove_from_filter : R.string.add_to_filter);
|
||||
}
|
||||
} else {
|
||||
|
@ -1061,6 +1121,9 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
mFollowButton = (Button) headerView.findViewById(R.id.follow);
|
||||
mFollowProgress = (ProgressBar) headerView.findViewById(R.id.follow_progress);
|
||||
mUuckyFooter = headerView.findViewById(R.id.uucky_footer);
|
||||
mPagesContent = view.findViewById(R.id.pages_content);
|
||||
mPagesErrorContainer = view.findViewById(R.id.pages_error_container);
|
||||
mPagesErrorText = (TextView) view.findViewById(R.id.pages_error_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1149,7 +1212,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
final FragmentActivity activity = getActivity();
|
||||
if (!(activity instanceof LinkHandlerActivity)) return;
|
||||
final LinkHandlerActivity linkHandler = (LinkHandlerActivity) activity;
|
||||
final ActionBar actionBar = linkHandler.getActionBar();
|
||||
final ActionBar actionBar = linkHandler.getSupportActionBar();
|
||||
if (actionBar == null) return;
|
||||
final int themeResId = linkHandler.getCurrentThemeResourceId();
|
||||
final Drawable shadow = activity.getResources().getDrawable(R.drawable.shadow_user_banner_action_bar);
|
||||
|
@ -1291,7 +1354,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
boolean colorLineOnly) {
|
||||
super(new Drawable[]{shadow, background, new LineBackgroundDrawable(resources, 2.0f),
|
||||
new ActionBarColorDrawable()});
|
||||
mShadowDrawable = shadow;
|
||||
mShadowDrawable = getDrawable(0);
|
||||
mBackgroundDrawable = getDrawable(1);
|
||||
mLineDrawable = (LineBackgroundDrawable) getDrawable(2);
|
||||
mColorDrawable = (ColorDrawable) getDrawable(3);
|
||||
|
@ -1429,4 +1492,6 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.activity.support.UserListSelectorActivity;
|
||||
import org.mariotaku.twidere.adapter.support.SupportTabsAdapter;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCallback;
|
||||
|
@ -70,7 +71,7 @@ import org.mariotaku.twidere.util.ParseUtils;
|
|||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.view.ColorLabelRelativeLayout;
|
||||
import org.mariotaku.twidere.view.ColorLabelLinearLayout;
|
||||
import org.mariotaku.twidere.view.HeaderDrawerLayout;
|
||||
import org.mariotaku.twidere.view.HeaderDrawerLayout.DrawerCallback;
|
||||
import org.mariotaku.twidere.view.TabPagerIndicator;
|
||||
|
@ -96,7 +97,7 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
|||
private ImageView mProfileImageView;
|
||||
private TextView mListNameView, mCreatedByView, mDescriptionView, mErrorMessageView;
|
||||
private View mErrorRetryContainer, mProgressContainer;
|
||||
private ColorLabelRelativeLayout mProfileContainer;
|
||||
private ColorLabelLinearLayout mUserListDetails;
|
||||
private Button mRetryButton;
|
||||
private HeaderDrawerLayout mHeaderDrawerLayout;
|
||||
private ViewPager mViewPager;
|
||||
|
@ -184,20 +185,19 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
|||
public void displayUserList(final ParcelableUserList userList) {
|
||||
if (userList == null || getActivity() == null) return;
|
||||
getLoaderManager().destroyLoader(0);
|
||||
final boolean isMyself = userList.account_id == userList.user_id;
|
||||
mErrorRetryContainer.setVisibility(View.GONE);
|
||||
mProgressContainer.setVisibility(View.GONE);
|
||||
mUserList = userList;
|
||||
mProfileContainer.drawEnd(getAccountColor(getActivity(), userList.account_id));
|
||||
mUserListDetails.drawEnd(getAccountColor(getActivity(), userList.account_id));
|
||||
mListNameView.setText(userList.name);
|
||||
final String display_name = UserColorNameUtils.getDisplayName(getActivity(), userList.user_id, userList.user_name,
|
||||
userList.user_screen_name, false);
|
||||
mCreatedByView.setText(getString(R.string.created_by, display_name));
|
||||
final String displayName = UserColorNameUtils.getDisplayName(getActivity(), userList.user_id,
|
||||
userList.user_name, userList.user_screen_name, false);
|
||||
mCreatedByView.setText(getString(R.string.created_by, displayName));
|
||||
final String description = userList.description;
|
||||
mDescriptionView.setVisibility(isMyself || !isEmpty(description) ? View.VISIBLE : View.GONE);
|
||||
mDescriptionView.setVisibility(isEmpty(description) ? View.GONE : View.VISIBLE);
|
||||
mDescriptionView.setText(description);
|
||||
final TwidereLinkify linkify = new TwidereLinkify(
|
||||
new OnLinkClickHandler(getActivity(), getMultiSelectManager()));
|
||||
final TwidereLinkify linkify = new TwidereLinkify(new OnLinkClickHandler(getActivity(),
|
||||
getMultiSelectManager()));
|
||||
linkify.applyAllLinks(mDescriptionView, userList.account_id, false);
|
||||
mDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
mProfileImageLoader.displayProfileImage(mProfileImageView, userList.user_profile_image_url);
|
||||
|
@ -275,11 +275,16 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
|||
mViewPager.setAdapter(mPagerAdapter);
|
||||
mPagerIndicator.setViewPager(mViewPager);
|
||||
mPagerIndicator.setTabDisplayOption(TabPagerIndicator.LABEL);
|
||||
if (activity instanceof IThemedActivity) {
|
||||
mPagerIndicator.setStripColor(((IThemedActivity) activity).getCurrentThemeColor());
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
mTwitterWrapper = getApplication().getTwitterWrapper();
|
||||
mProfileImageLoader = getApplication().getImageLoaderWrapper();
|
||||
mProfileImageView.setOnClickListener(this);
|
||||
mProfileContainer.setOnClickListener(this);
|
||||
mUserListDetails.setOnClickListener(this);
|
||||
mRetryButton.setOnClickListener(this);
|
||||
getUserListInfo(false);
|
||||
|
||||
|
@ -474,7 +479,7 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
|
|||
final View headerView = mHeaderDrawerLayout.getHeader();
|
||||
final View contentView = mHeaderDrawerLayout.getContent();
|
||||
mCardView = (CardView) headerView.findViewById(R.id.card);
|
||||
mProfileContainer = (ColorLabelRelativeLayout) headerView.findViewById(R.id.profile);
|
||||
mUserListDetails = (ColorLabelLinearLayout) headerView.findViewById(R.id.user_list_details);
|
||||
mListNameView = (TextView) headerView.findViewById(R.id.list_name);
|
||||
mCreatedByView = (TextView) headerView.findViewById(R.id.created_by);
|
||||
mDescriptionView = (TextView) headerView.findViewById(R.id.description);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.support.MenuDialogFragment;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.addIntentToMenu;
|
||||
|
||||
public class UserListMenuDialogFragment extends MenuDialogFragment {
|
||||
|
||||
@Override
|
||||
protected void onCreateMenu(final MenuInflater inflater, final Menu menu) {
|
||||
final SharedPreferences prefs = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final Bundle args = getArguments();
|
||||
final ParcelableUserList user = args.getParcelable(EXTRA_USER_LIST);
|
||||
inflater.inflate(R.menu.action_user_list, menu);
|
||||
onPrepareItemMenu(menu, user);
|
||||
final Intent extensionsIntent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER_LIST);
|
||||
final Bundle extensionsExtras = new Bundle();
|
||||
extensionsExtras.putParcelable(EXTRA_USER_LIST, user);
|
||||
extensionsIntent.putExtras(extensionsExtras);
|
||||
addIntentToMenu(getThemedContext(), menu, extensionsIntent);
|
||||
}
|
||||
|
||||
protected void onPrepareItemMenu(final Menu menu, final ParcelableUserList userList) {
|
||||
if (userList == null) return;
|
||||
final boolean isMyList = userList.user_id == userList.account_id;
|
||||
Utils.setMenuItemAvailability(menu, MENU_ADD, isMyList);
|
||||
Utils.setMenuItemAvailability(menu, MENU_DELETE, isMyList);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
||||
import org.mariotaku.twidere.activity.support.MenuDialogFragment;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.addIntentToMenu;
|
||||
|
||||
public class UserMenuDialogFragment extends MenuDialogFragment {
|
||||
|
||||
@Override
|
||||
protected void onCreateMenu(final MenuInflater inflater, final Menu menu) {
|
||||
final SharedPreferences prefs = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final Bundle args = getArguments();
|
||||
final ParcelableUser user = args.getParcelable(EXTRA_USER);
|
||||
onPrepareItemMenu(menu, user);
|
||||
final Intent extensionsIntent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER);
|
||||
final Bundle extensionsExtras = new Bundle();
|
||||
extensionsExtras.putParcelable(EXTRA_USER, user);
|
||||
extensionsIntent.putExtras(extensionsExtras);
|
||||
addIntentToMenu(getThemedContext(), menu, extensionsIntent);
|
||||
}
|
||||
|
||||
protected void onPrepareItemMenu(final Menu menu, final ParcelableUser user) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 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.graphic;
|
||||
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/1/16.
|
||||
*/
|
||||
public class ActionIconDrawable extends DrawableWrapper {
|
||||
|
||||
private final int mDefaultColor;
|
||||
|
||||
public ActionIconDrawable(Drawable drawable, int defaultColor) {
|
||||
super(drawable);
|
||||
mDefaultColor = defaultColor;
|
||||
setHighlightColor(0);
|
||||
}
|
||||
|
||||
public static void setMenuHighlight(MenuItem item, TwidereMenuInfo info) {
|
||||
final Drawable icon = item.getIcon();
|
||||
if (icon instanceof ActionIconDrawable) {
|
||||
((ActionIconDrawable) icon).setHighlightColor(info.isHighlight() ? info.getHighlightColor(0) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void setHighlightColor(int color) {
|
||||
setColorFilter(color == 0 ? mDefaultColor : color, Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 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.graphic;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.os.Build;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Base wrapper that delegates all calls to another {@link Drawable}. The wrapped {@link Drawable}
|
||||
* <em>must</em> be fully released from any {@link View} before wrapping, otherwise internal {@link
|
||||
* Drawable.Callback} may be dropped.
|
||||
*/
|
||||
class DrawableWrapper extends Drawable implements Drawable.Callback {
|
||||
|
||||
private final Drawable mDrawable;
|
||||
|
||||
public DrawableWrapper(Drawable drawable) {
|
||||
mDrawable = drawable;
|
||||
mDrawable.setCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
mDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int left, int top, int right, int bottom) {
|
||||
super.setBounds(left, top, right, bottom);
|
||||
mDrawable.setBounds(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChangingConfigurations(int configs) {
|
||||
mDrawable.setChangingConfigurations(configs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChangingConfigurations() {
|
||||
return mDrawable.getChangingConfigurations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDither(boolean dither) {
|
||||
mDrawable.setDither(dither);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilterBitmap(boolean filter) {
|
||||
mDrawable.setFilterBitmap(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
mDrawable.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
mDrawable.setColorFilter(cf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStateful() {
|
||||
return mDrawable.isStateful();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setState(final int[] stateSet) {
|
||||
return mDrawable.setState(stateSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getState() {
|
||||
return mDrawable.getState();
|
||||
}
|
||||
|
||||
public void jumpToCurrentState() {
|
||||
DrawableCompat.jumpToCurrentState(mDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getCurrent() {
|
||||
return mDrawable.getCurrent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setVisible(boolean visible, boolean restart) {
|
||||
return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return mDrawable.getOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region getTransparentRegion() {
|
||||
return mDrawable.getTransparentRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return mDrawable.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
return mDrawable.getIntrinsicHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumWidth() {
|
||||
return mDrawable.getMinimumWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumHeight() {
|
||||
return mDrawable.getMinimumHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPadding(Rect padding) {
|
||||
return mDrawable.getPadding(padding);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void invalidateDrawable(Drawable who) {
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void scheduleDrawable(Drawable who, Runnable what, long when) {
|
||||
scheduleSelf(what, when);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void unscheduleDrawable(Drawable who, Runnable what) {
|
||||
unscheduleSelf(what);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onLevelChange(int level) {
|
||||
return mDrawable.setLevel(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoMirrored(boolean mirrored) {
|
||||
DrawableCompat.setAutoMirrored(mDrawable, mirrored);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoMirrored() {
|
||||
return DrawableCompat.isAutoMirrored(mDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTint(int tint) {
|
||||
DrawableCompat.setTint(mDrawable, tint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTintList(ColorStateList tint) {
|
||||
DrawableCompat.setTintList(mDrawable, tint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTintMode(PorterDuff.Mode tintMode) {
|
||||
DrawableCompat.setTintMode(mDrawable, tintMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHotspot(float x, float y) {
|
||||
DrawableCompat.setHotspot(mDrawable, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHotspotBounds(int left, int top, int right, int bottom) {
|
||||
DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package org.mariotaku.twidere.graphic.icon;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import com.atermenji.android.iconicdroid.icon.Icon;
|
||||
import com.atermenji.android.iconicdroid.util.TypefaceManager.IconicTypeface;
|
||||
|
||||
public enum TwidereIcon implements Icon {
|
||||
// Brand icons
|
||||
TWIDERE(0xF000), OPEN_SOURCE(0xF001), TWITTER(0xF002), TRANSLATE(0xF003), TWIDERE_SQUARE(0xF010),
|
||||
|
||||
ADD(0xF020), EDIT(0xF021), SAVE(0xF022), DELETE(0xF023), OK(0xF024), CANCEL(0xF025), REFRESH(0xF026), MORE(0xF027), COPY(
|
||||
0xF028), CUT(0xF029), PASTE(0xF02A), SELECT_ALL(0xF02B), STAR(0xF02C), SEND(0xF02D), SHARE(0xF02E), NEW_MESSAGE(
|
||||
0xF02F), CHECKED(0xF030), IMPORT(0xF034), EXPORT(0xF035),
|
||||
|
||||
PREFERENCES(0xF040), SEARCH(0xF041), INFO(0xF042), HELP(0xF043), COLLAPSE(0xF044), EXPAND(0xF045), PREVIOUS(0xF046), NEXT(
|
||||
0xF047), MIC(0xF048), MIC_MUTED(0xF049), SPEAKER(0xF04A), SPEAKER_MUTED(0xF04B), LOCK(0xF04C), UNLOCK(
|
||||
0xF04D), WARNING(0xF04E), ERROR(0xF04F),
|
||||
|
||||
NOTIFICATION(0xF050), LOCATION_OFF(0xF058), LOCATION_SEARCHING(0xF059), LOCATION_FOUND(0xF05A), CAMERA(0xF05C), CAMCORDER(
|
||||
0xF05D), GALLERY(0xF05E),
|
||||
|
||||
USER(0xF068), USERS(0xF069), USER_GROUP(0xF06A),
|
||||
|
||||
HOME(0xF080), MESSAGE(0xF081), INBOX(0xF082), OUTBOX(0xF083), LIST(0xF084), GRID(0xF085), STACK(0xF086), STAGGERED(
|
||||
0xF087), REPLY(0xF088), RETWEET(0xF089), QUOTE(0xF08A), AT(0xF08B), COMPOSE(0xF08C), HEART(0xF08D), COLOR_PALETTE(
|
||||
0xF08E), BLOCK(0xF08F), HASHTAG(0xF090), TRENDS(0xF091), DRAFTS(0xF092),
|
||||
|
||||
TAB(0xF0A0), EXTENSION(0xF0A1), CARD(0xF0A2), INTERFACE(0xF0A3), WEB(0xF0A4), SERVER(0xF0A5), STORAGE(0xF0A6);
|
||||
|
||||
private final int mIconUtfValue;
|
||||
|
||||
private TwidereIcon(final int iconUtfValue) {
|
||||
mIconUtfValue = iconUtfValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IconicTypeface getIconicTypeface() {
|
||||
return TwidereIconTypeface.SINGLETON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconUtfValue() {
|
||||
return mIconUtfValue;
|
||||
}
|
||||
|
||||
private static final class TwidereIconTypeface implements IconicTypeface {
|
||||
|
||||
static final TwidereIconTypeface SINGLETON = new TwidereIconTypeface();
|
||||
|
||||
private Typeface mTypeface;
|
||||
|
||||
@Override
|
||||
public Typeface getTypeface(final Context context) {
|
||||
if (mTypeface == null) {
|
||||
mTypeface = Typeface.createFromAsset(context.getAssets(), "fonts/TwidereIconic.ttf");
|
||||
}
|
||||
return mTypeface;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.Paging;
|
||||
|
@ -57,7 +56,7 @@ public class TweetSearchLoader extends Twitter4JStatusesLoader {
|
|||
if (paging.getMaxId() > 0) {
|
||||
query.setMaxId(paging.getMaxId());
|
||||
}
|
||||
return Arrays.asList(twitter.search(query).getStatuses());
|
||||
return twitter.search(query);
|
||||
}
|
||||
|
||||
protected String processQuery(final String query) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import org.mariotaku.jsonserializer.JSONFileIO;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
|
@ -74,7 +75,6 @@ public abstract class Twitter4JStatusesLoader extends ParcelableStatusesLoader {
|
|||
public final List<ParcelableStatus> loadInBackground() {
|
||||
final File serializationFile = getSerializationFile();
|
||||
final List<ParcelableStatus> data = getData();
|
||||
if (!isFromUser()) return data;
|
||||
if (isFirstLoad() && getTabPosition() >= 0 && serializationFile != null) {
|
||||
final List<ParcelableStatus> cached = getCachedData(serializationFile);
|
||||
if (cached != null) {
|
||||
|
@ -87,6 +87,7 @@ public abstract class Twitter4JStatusesLoader extends ParcelableStatusesLoader {
|
|||
return new CopyOnWriteArrayList<>(data);
|
||||
}
|
||||
}
|
||||
if (!isFromUser()) return data;
|
||||
final List<Status> statuses;
|
||||
final boolean truncated;
|
||||
final Context context = getContext();
|
||||
|
@ -105,7 +106,7 @@ public abstract class Twitter4JStatusesLoader extends ParcelableStatusesLoader {
|
|||
truncated = truncateStatuses(getStatuses(getTwitter(), paging), statuses, mSinceId);
|
||||
} catch (final TwitterException e) {
|
||||
// mHandler.post(new ShowErrorRunnable(e));
|
||||
e.printStackTrace();
|
||||
Log.w(LOGTAG, e);
|
||||
return new CopyOnWriteArrayList<>(data);
|
||||
}
|
||||
final long minStatusId = statuses.isEmpty() ? -1 : Collections.min(statuses).getId();
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 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.menu;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.support.v4.view.ActionProvider;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.model.ParcelableAccount;
|
||||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.BadgeView;
|
||||
import org.mariotaku.twidere.view.ShapedImageView;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/1/17.
|
||||
*/
|
||||
public class ComposeAccountActionProvider extends ActionProvider implements OnClickListener {
|
||||
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private ShapedImageView mProfileImageView;
|
||||
private BadgeView mCountView;
|
||||
private InvokedListener mInvokedListener;
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mInvokedListener == null) return;
|
||||
mInvokedListener.onInvoked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPerformDefaultAction() {
|
||||
if (mInvokedListener == null) return false;
|
||||
mInvokedListener.onInvoked();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubMenu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*
|
||||
* @param context Context for accessing resources.
|
||||
*/
|
||||
public ComposeAccountActionProvider(Context context) {
|
||||
super(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateActionView() {
|
||||
final Context context = getContext();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
@SuppressLint("InflateParams")
|
||||
final View view = inflater.inflate(R.layout.action_item_account_selector, null);
|
||||
view.setOnClickListener(this);
|
||||
mProfileImageView = (ShapedImageView) view.findViewById(R.id.account_profile_image);
|
||||
mCountView = (BadgeView) view.findViewById(R.id.accounts_count);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setInvokedListener(InvokedListener listener) {
|
||||
mInvokedListener = listener;
|
||||
}
|
||||
|
||||
public void setSelectedAccounts(ParcelableAccount... accounts) {
|
||||
if (accounts.length == 1) {
|
||||
mCountView.setText(null);
|
||||
final ParcelableAccount account = accounts[0];
|
||||
mImageLoader.displayProfileImage(mProfileImageView, account.profile_image_url);
|
||||
mProfileImageView.setBorderColor(account.color);
|
||||
} else {
|
||||
mCountView.setText(String.valueOf(accounts.length));
|
||||
mImageLoader.cancelDisplayTask(mProfileImageView);
|
||||
mProfileImageView.setImageDrawable(new ColorDrawable(Color.WHITE));
|
||||
mProfileImageView.setBorderColors(Utils.getAccountColors(accounts));
|
||||
}
|
||||
}
|
||||
|
||||
public static interface InvokedListener {
|
||||
|
||||
void onInvoked();
|
||||
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ package org.mariotaku.twidere.menu;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.ActionProvider;
|
||||
import android.support.v4.view.ActionProvider;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
|
|
|
@ -23,16 +23,18 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.preference.Preference;
|
||||
import android.support.v7.internal.view.SupportMenuInflater;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.MenuBar;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
@ -86,7 +88,7 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
|
|||
final View windowContentOverlayView = view.findViewById(R.id.theme_preview_window_content_overlay);
|
||||
final View actionBarView = view.findViewById(R.id.actionbar);
|
||||
final TextView actionBarTitleView = (TextView) view.findViewById(R.id.actionbar_title);
|
||||
final MenuBar actionBarSplitView = (MenuBar) view.findViewById(R.id.menu_bar);
|
||||
final ActionMenuView actionBarSplitView = (ActionMenuView) view.findViewById(R.id.menu_bar);
|
||||
final View statusContentView = view.findViewById(R.id.theme_preview_status_content);
|
||||
|
||||
final int defaultTextSize = getDefaultTextSize(context);
|
||||
|
@ -98,9 +100,8 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
|
|||
|
||||
actionBarTitleView.setTextAppearance(context, titleTextAppearance);
|
||||
actionBarSplitView.setEnabled(false);
|
||||
actionBarSplitView.inflate(R.menu.menu_status);
|
||||
actionBarSplitView.setIsBottomBar(true);
|
||||
actionBarSplitView.show();
|
||||
final MenuInflater inflater = new SupportMenuInflater(context);
|
||||
inflater.inflate(R.menu.menu_status, actionBarSplitView.getMenu());
|
||||
if (statusContentView != null) {
|
||||
ViewAccessor.setBackground(statusContentView, ThemeUtils.getWindowBackground(context));
|
||||
|
||||
|
|
|
@ -42,4 +42,28 @@ public class ColorUtils {
|
|||
return Color.argb(alpha, r, g, b);
|
||||
}
|
||||
|
||||
public static int getContrastYIQ(int color, int colorDark, int colorLight) {
|
||||
return getContrastYIQ(color, 128, colorDark, colorLight);
|
||||
}
|
||||
|
||||
public static int getContrastYIQ(int color) {
|
||||
return getContrastYIQ(color, 128);
|
||||
}
|
||||
|
||||
public static int getContrastYIQ(int color, int threshold) {
|
||||
return getContrastYIQ(color, threshold, Color.BLACK, Color.WHITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get most contrasting color
|
||||
*
|
||||
* @param color Input color, alpha channel will be disposed.
|
||||
* @return {@link android.graphics.Color#WHITE} or {@link android.graphics.Color#BLACK}
|
||||
* @see <a href='http://24ways.org/2010/calculating-color-contrast/'>Calculating Color Contrast</a>
|
||||
*/
|
||||
public static int getContrastYIQ(int color, int threshold, int colorDark, int colorLight) {
|
||||
final int r = Color.red(color), g = Color.green(color), b = Color.blue(color);
|
||||
final int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
||||
return (yiq >= threshold) ? colorDark : colorLight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ import android.graphics.drawable.Drawable;
|
|||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.internal.view.menu.ActionMenuItemView;
|
||||
import android.support.v7.widget.ActionMenuView;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
|
@ -45,18 +47,17 @@ import android.view.ContextThemeWrapper;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mariotaku.menucomponent.internal.Utils;
|
||||
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarMenuInfo;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.graphic.ActionBarColorDrawable;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
import org.mariotaku.twidere.text.ParagraphSpacingSpan;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
|
@ -108,6 +109,16 @@ public class ThemeUtils implements Constants {
|
|||
actionBar.setStackedBackgroundDrawable(getActionBarStackedBackground(context, themeRes));
|
||||
}
|
||||
|
||||
|
||||
public static void applyActionBarBackground(final android.support.v7.app.ActionBar actionBar, final Context context,
|
||||
final int themeRes, final int accentColor) {
|
||||
if (actionBar == null || context == null) return;
|
||||
actionBar.setBackgroundDrawable(getActionBarBackground(context, themeRes, accentColor));
|
||||
actionBar.setSplitBackgroundDrawable(getActionBarSplitBackground(context, themeRes));
|
||||
actionBar.setStackedBackgroundDrawable(getActionBarStackedBackground(context, themeRes));
|
||||
}
|
||||
|
||||
|
||||
public static void applyBackground(final View view) {
|
||||
if (view == null) return;
|
||||
applyBackground(view, getUserAccentColor(view.getContext()));
|
||||
|
@ -127,6 +138,71 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
}
|
||||
|
||||
public static void resetCheatSheet(ActionMenuView menuView) {
|
||||
final OnLongClickListener listener = new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (((ActionMenuItemView) v).hasText()) return false;
|
||||
final MenuItem menuItem = ((ActionMenuItemView) v).getItemData();
|
||||
Utils.showMenuItemToast(v, menuItem.getTitle(), true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
for (int i = 0, j = menuView.getChildCount(); i < j; i++) {
|
||||
final View child = menuView.getChildAt(i);
|
||||
if (!(child instanceof ActionMenuItemView)) continue;
|
||||
final ActionMenuItemView itemView = (ActionMenuItemView) child;
|
||||
final MenuItem menuItem = itemView.getItemData();
|
||||
if (menuItem.hasSubMenu()) continue;
|
||||
itemView.setOnLongClickListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public static void wrapMenuIcon(@NonNull Menu menu, int itemColor, int subItemColor, int... excludeGroups) {
|
||||
for (int i = 0, j = menu.size(); i < j; i++) {
|
||||
final MenuItem item = menu.getItem(i);
|
||||
wrapMenuItemIcon(item, itemColor, excludeGroups);
|
||||
if (item.hasSubMenu()) {
|
||||
wrapMenuIcon(item.getSubMenu(), subItemColor, subItemColor, excludeGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void wrapMenuItemIcon(@NonNull MenuItem item, int itemColor, int... excludeGroups) {
|
||||
if (ArrayUtils.contains(excludeGroups, item.getGroupId())) return;
|
||||
final Drawable icon = item.getIcon();
|
||||
if (icon == null) return;
|
||||
icon.mutate();
|
||||
final Drawable.Callback callback = icon.getCallback();
|
||||
final ActionIconDrawable newIcon = new ActionIconDrawable(icon, itemColor);
|
||||
newIcon.setCallback(callback);
|
||||
item.setIcon(newIcon);
|
||||
}
|
||||
|
||||
public static void wrapMenuIcon(ActionMenuView view, int... excludeGroups) {
|
||||
final int itemBackgroundColor = ThemeUtils.getThemeBackgroundColor(view.getContext());
|
||||
final int popupItemBackgroundColor = ThemeUtils.getThemeBackgroundColor(view.getContext(), view.getPopupTheme());
|
||||
final Resources resources = view.getResources();
|
||||
final int colorDark = resources.getColor(R.color.action_icon_dark);
|
||||
final int colorLight = resources.getColor(R.color.action_icon_light);
|
||||
final int itemColor = ColorUtils.getContrastYIQ(itemBackgroundColor, colorDark, colorLight);
|
||||
final int popupItemColor = ColorUtils.getContrastYIQ(popupItemBackgroundColor, colorDark, colorLight);
|
||||
final Menu menu = view.getMenu();
|
||||
final int childCount = view.getChildCount();
|
||||
for (int i = 0, j = menu.size(), k = 0; i < j; i++) {
|
||||
final MenuItem item = menu.getItem(i);
|
||||
wrapMenuItemIcon(item, itemColor, excludeGroups);
|
||||
if (item.hasSubMenu()) {
|
||||
wrapMenuIcon(menu, popupItemColor, popupItemColor, excludeGroups);
|
||||
}
|
||||
if (item.isVisible()) {
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void applyThemeAlphaToDrawable(final Context context, final Drawable d) {
|
||||
if (context == null || d == null) return;
|
||||
d.setAlpha(getThemeAlpha(getThemeResource(context)));
|
||||
|
@ -137,14 +213,25 @@ public class ThemeUtils implements Constants {
|
|||
d.setAlpha(getUserThemeBackgroundAlpha(context));
|
||||
}
|
||||
|
||||
|
||||
public static int getActionBarPopupThemeRes(final Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return 0;
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.actionBarPopupTheme});
|
||||
try {
|
||||
return a.getResourceId(0, 0);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyColorFilterToMenuIcon(Activity activity, Menu menu) {
|
||||
final ActionBar actionBar = activity.getActionBar();
|
||||
final Context context = actionBar != null ? actionBar.getThemedContext() : activity;
|
||||
final int color = getThemeForegroundColor(context);
|
||||
final int popupTheme = Utils.getActionBarPopupThemeRes(context);
|
||||
final int popupColor = ThemeUtils.getThemeForegroundColor(context, popupTheme);
|
||||
final int highlightColor = ThemeUtils.getUserAccentColor(activity);
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, color, popupColor, highlightColor, Mode.SRC_ATOP);
|
||||
final int popupTheme = getActionBarPopupThemeRes(context);
|
||||
final int popupColor = getThemeForegroundColor(context, popupTheme);
|
||||
final int highlightColor = getUserAccentColor(activity);
|
||||
applyColorFilterToMenuIcon(menu, color, popupColor, highlightColor, Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
public static void applyColorFilterToMenuIcon(final Menu menu, final int color,
|
||||
|
@ -162,17 +249,7 @@ public class ThemeUtils implements Constants {
|
|||
final ContextMenuInfo info = item.getMenuInfo();
|
||||
if (icon != null && !ArrayUtils.contains(excludedGroups, item.getGroupId())) {
|
||||
icon.mutate();
|
||||
if (info instanceof MenuBarMenuInfo) {
|
||||
final MenuBarMenuInfo mbInfo = (MenuBarMenuInfo) info;
|
||||
final boolean inPopup = mbInfo.isInPopup();
|
||||
if (mbInfo.getMenuInfo() instanceof TwidereMenuInfo) {
|
||||
final TwidereMenuInfo sInfo = (TwidereMenuInfo) mbInfo.getMenuInfo();
|
||||
icon.setColorFilter(sInfo.isHighlight() ? sInfo.getHighlightColor(highlightColor)
|
||||
: (inPopup ? popupColor : color), mode);
|
||||
} else {
|
||||
icon.setColorFilter(inPopup ? popupColor : color, mode);
|
||||
}
|
||||
} else if (info instanceof TwidereMenuInfo) {
|
||||
if (info instanceof TwidereMenuInfo) {
|
||||
final TwidereMenuInfo sInfo = (TwidereMenuInfo) info;
|
||||
icon.setColorFilter(sInfo.isHighlight() ?
|
||||
sInfo.getHighlightColor(highlightColor) : color, mode);
|
||||
|
@ -565,11 +642,22 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
|
||||
public static int getThemeBackgroundColor(final Context context) {
|
||||
final Resources res = getResources(context);
|
||||
final Context wrapped = getThemedContext(context, res);
|
||||
final TypedArray a = wrapped.obtainStyledAttributes(new int[]{android.R.attr.colorBackground});
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorBackground});
|
||||
try {
|
||||
return a.getColor(0, Color.GRAY);
|
||||
return a.getColor(0, 0);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getThemeBackgroundColor(final Context context, int themeRes) {
|
||||
if (themeRes == 0) {
|
||||
return getThemeBackgroundColor(context);
|
||||
}
|
||||
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.colorBackground},
|
||||
0, themeRes);
|
||||
try {
|
||||
return a.getColor(0, 0);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
|
@ -608,6 +696,29 @@ public class ThemeUtils implements Constants {
|
|||
getDarkActionBarOption(context));
|
||||
}
|
||||
|
||||
public static int getNoActionBarThemeResource(final Context context) {
|
||||
return getNoActionBarThemeResource(getThemeNameOption(context), getThemeBackgroundOption(context),
|
||||
getDarkActionBarOption(context));
|
||||
}
|
||||
|
||||
public static int getNoActionBarThemeResource(final String name, final String background, final boolean darkActionBar) {
|
||||
if (VALUE_THEME_NAME_LIGHT.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
return R.style.Theme_Twidere_Light_SolidBackground_NoActionBar;
|
||||
else if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(background))
|
||||
return R.style.Theme_Twidere_Light_Transparent_NoActionBar;
|
||||
return R.style.Theme_Twidere_Light_NoActionBar;
|
||||
|
||||
} else if (VALUE_THEME_NAME_DARK.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
return R.style.Theme_Twidere_Dark_SolidBackground_NoActionBar;
|
||||
else if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(background))
|
||||
return R.style.Theme_Twidere_Dark_Transparent_NoActionBar;
|
||||
return R.style.Theme_Twidere_Dark_NoActionBar;
|
||||
}
|
||||
return R.style.Theme_Twidere_Light_NoActionBar;
|
||||
}
|
||||
|
||||
public static int getThemeResource(final String name, final String background, final boolean darkActionBar) {
|
||||
if (VALUE_THEME_NAME_LIGHT.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
|
|
|
@ -64,6 +64,7 @@ import android.os.SystemClock;
|
|||
import android.provider.BaseColumns;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
@ -73,7 +74,11 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v4.view.ActionProvider;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityEventCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.ShareActionProvider;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
|
@ -85,7 +90,6 @@ import android.transition.Transition;
|
|||
import android.transition.TransitionInflater;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ActionProvider;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -109,7 +113,6 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||
import org.apache.http.NameValuePair;
|
||||
import org.json.JSONException;
|
||||
import org.mariotaku.jsonserializer.JSONSerializer;
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.querybuilder.AllColumns;
|
||||
import org.mariotaku.querybuilder.Columns;
|
||||
import org.mariotaku.querybuilder.Columns.Column;
|
||||
|
@ -157,6 +160,7 @@ import org.mariotaku.twidere.fragment.support.UserMediaTimelineFragment;
|
|||
import org.mariotaku.twidere.fragment.support.UserMentionsFragment;
|
||||
import org.mariotaku.twidere.fragment.support.UserTimelineFragment;
|
||||
import org.mariotaku.twidere.fragment.support.UsersListFragment;
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable;
|
||||
import org.mariotaku.twidere.graphic.PaddingDrawable;
|
||||
import org.mariotaku.twidere.menu.StatusShareProvider;
|
||||
import org.mariotaku.twidere.model.AccountPreferences;
|
||||
|
@ -259,6 +263,7 @@ import static org.mariotaku.twidere.provider.TwidereDataStore.STATUSES_URIS;
|
|||
import static org.mariotaku.twidere.util.TwidereLinkify.PATTERN_TWITTER_PROFILE_IMAGES;
|
||||
import static org.mariotaku.twidere.util.TwidereLinkify.TWITTER_PROFILE_IMAGES_AVAILABLE_SIZES;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Utils implements Constants, TwitterConstants {
|
||||
|
||||
private static final String UA_TEMPLATE = "Mozilla/5.0 (Linux; Android %s; %s Build/%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.111 Safari/537.36";
|
||||
|
@ -738,6 +743,15 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
}
|
||||
|
||||
public static int[] getAccountColors(@Nullable final ParcelableAccount[] accounts) {
|
||||
if (accounts == null) return null;
|
||||
final int[] colors = new int[accounts.length];
|
||||
for (int i = 0, j = accounts.length; i < j; i++) {
|
||||
colors[i] = accounts[i].color;
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public static Bitmap getCircleBitmap(Bitmap bitmap) {
|
||||
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
|
||||
Bitmap.Config.ARGB_8888);
|
||||
|
@ -766,7 +780,6 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
|
||||
public static Fragment createFragmentForIntent(final Context context, final int linkId, final Intent intent) {
|
||||
final long start = System.currentTimeMillis();
|
||||
intent.setExtrasClassLoader(context.getClassLoader());
|
||||
final Bundle extras = intent.getExtras();
|
||||
final Uri uri = intent.getData();
|
||||
|
@ -1047,9 +1060,6 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
}
|
||||
fragment.setArguments(args);
|
||||
if (isDebugBuild()) {
|
||||
Log.d(LOGTAG, String.format("createFragmentForIntent used %d ms", System.currentTimeMillis() - start));
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
@ -3337,9 +3347,16 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
|
||||
public static int getInsetsTopWithoutActionBarHeight(Context context, int top) {
|
||||
if (context instanceof Activity) {
|
||||
final ActionBar actionBar = ((Activity) context).getActionBar();
|
||||
if (actionBar != null) return top - getActionBarHeight(actionBar);
|
||||
final int actionBarHeight;
|
||||
if (context instanceof ActionBarActivity) {
|
||||
actionBarHeight = getActionBarHeight(((ActionBarActivity) context).getSupportActionBar());
|
||||
} else if (context instanceof Activity) {
|
||||
actionBarHeight = getActionBarHeight(((Activity) context).getActionBar());
|
||||
} else {
|
||||
return top;
|
||||
}
|
||||
if (actionBarHeight < top) {
|
||||
return top - actionBarHeight;
|
||||
}
|
||||
return top;
|
||||
}
|
||||
|
@ -3514,17 +3531,17 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
final MenuItem retweet = menu.findItem(MENU_RETWEET);
|
||||
if (retweet != null) {
|
||||
retweet.setVisible(!status.user_is_protected || isMyRetweet);
|
||||
MenuUtils.setMenuInfo(retweet, new TwidereMenuInfo(isMyRetweet, retweetHighlight));
|
||||
ActionIconDrawable.setMenuHighlight(retweet, new TwidereMenuInfo(isMyRetweet, retweetHighlight));
|
||||
retweet.setTitle(isMyRetweet ? R.string.cancel_retweet : R.string.retweet);
|
||||
}
|
||||
final MenuItem retweetSubItem = menu.findItem(R.id.retweet_submenu);
|
||||
if (retweetSubItem != null) {
|
||||
MenuUtils.setMenuInfo(retweetSubItem, new TwidereMenuInfo(isMyRetweet,
|
||||
ActionIconDrawable.setMenuHighlight(retweetSubItem, new TwidereMenuInfo(isMyRetweet,
|
||||
retweetHighlight));
|
||||
}
|
||||
final MenuItem favorite = menu.findItem(MENU_FAVORITE);
|
||||
if (favorite != null) {
|
||||
MenuUtils.setMenuInfo(favorite, new TwidereMenuInfo(status.is_favorite, favoriteHighlight));
|
||||
ActionIconDrawable.setMenuHighlight(favorite, new TwidereMenuInfo(status.is_favorite, favoriteHighlight));
|
||||
favorite.setTitle(status.is_favorite ? R.string.unfavorite : R.string.favorite);
|
||||
}
|
||||
final MenuItem translate = menu.findItem(MENU_TRANSLATE);
|
||||
|
@ -3536,17 +3553,19 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
addIntentToMenuForExtension(context, menu, MENU_GROUP_STATUS_EXTENSION, INTENT_ACTION_EXTENSION_OPEN_STATUS,
|
||||
EXTRA_STATUS, EXTRA_STATUS_JSON, status);
|
||||
final MenuItem shareItem = menu.findItem(R.id.share);
|
||||
final ActionProvider shareProvider = shareItem.getActionProvider();
|
||||
final ActionProvider shareProvider = MenuItemCompat.getActionProvider(shareItem);
|
||||
if (shareProvider instanceof StatusShareProvider) {
|
||||
((StatusShareProvider) shareProvider).setStatus(status);
|
||||
} else {
|
||||
if (shareItem.hasSubMenu()) {
|
||||
final Menu shareSubMenu = shareItem.getSubMenu();
|
||||
final Intent shareIntent = createStatusShareIntent(context, status);
|
||||
shareSubMenu.removeGroup(MENU_GROUP_STATUS_SHARE);
|
||||
addIntentToMenu(context, shareSubMenu, shareIntent, MENU_GROUP_STATUS_SHARE);
|
||||
}
|
||||
} else if (shareProvider instanceof ShareActionProvider) {
|
||||
final Intent shareIntent = createStatusShareIntent(context, status);
|
||||
((ShareActionProvider) shareProvider).setShareIntent(shareIntent);
|
||||
} else if (shareItem.hasSubMenu()) {
|
||||
final Menu shareSubMenu = shareItem.getSubMenu();
|
||||
final Intent shareIntent = createStatusShareIntent(context, status);
|
||||
shareSubMenu.removeGroup(MENU_GROUP_STATUS_SHARE);
|
||||
addIntentToMenu(context, shareSubMenu, shareIntent, MENU_GROUP_STATUS_SHARE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setMenuItemAvailability(final Menu menu, final int id, final boolean available) {
|
||||
|
@ -3584,7 +3603,7 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
cb.setHttpUserAgent(APP_NAME + " " + APP_PROJECT_URL + " / " + version_name
|
||||
+ (gzipCompressing ? " (gzip)" : ""));
|
||||
} catch (final PackageManager.NameNotFoundException e) {
|
||||
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3864,8 +3883,7 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
private static Drawable getMetadataDrawable(final PackageManager pm, final ActivityInfo info, final String key) {
|
||||
if (pm == null || info == null || info.metaData == null || key == null || !info.metaData.containsKey(key))
|
||||
return null;
|
||||
final Drawable d = pm.getDrawable(info.packageName, info.metaData.getInt(key), info.applicationInfo);
|
||||
return d;
|
||||
return pm.getDrawable(info.packageName, info.metaData.getInt(key), info.applicationInfo);
|
||||
}
|
||||
|
||||
private static boolean isErrorCodeMessageSupported(final TwitterException te) {
|
||||
|
@ -3896,6 +3914,18 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static int getActionBarHeight(android.support.v7.app.ActionBar actionBar) {
|
||||
if (actionBar == null) return 0;
|
||||
final Context context = actionBar.getThemedContext();
|
||||
final TypedValue tv = new TypedValue();
|
||||
final int height = actionBar.getHeight();
|
||||
if (height > 0) return height;
|
||||
if (context.getTheme().resolveAttribute(R.attr.actionBarSize, tv, true)) {
|
||||
return TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getActionBarHeight(Context context) {
|
||||
final TypedValue tv = new TypedValue();
|
||||
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
|
||||
|
@ -3914,31 +3944,6 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
}
|
||||
|
||||
public static int getContrastYIQ(int color) {
|
||||
return getContrastYIQ(color, 128);
|
||||
}
|
||||
|
||||
|
||||
public static int getContrastYIQ(int color, int threshold) {
|
||||
return getContrastYIQ(color, threshold, Color.BLACK, Color.WHITE);
|
||||
}
|
||||
|
||||
public static int getContrastYIQ(int color, int colorDark, int colorLight) {
|
||||
return getContrastYIQ(color, 128, colorDark, colorLight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get most contrasting color
|
||||
*
|
||||
* @param color Input color, alpha channel will be disposed.
|
||||
* @return {@link Color#WHITE} or {@link Color#BLACK}
|
||||
* @see <a href='http://24ways.org/2010/calculating-color-contrast/'>Calculating Color Contrast</a>
|
||||
*/
|
||||
public static int getContrastYIQ(int color, int threshold, int colorDark, int colorLight) {
|
||||
final int r = Color.red(color), g = Color.green(color), b = Color.blue(color);
|
||||
final int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
||||
return (yiq >= threshold) ? colorDark : colorLight;
|
||||
}
|
||||
|
||||
public static void makeListFragmentFitsSystemWindows(ListFragment fragment, Rect insets) {
|
||||
final ListView listView = fragment.getListView();
|
||||
|
|
|
@ -27,8 +27,13 @@ public class ActionIconView extends ImageView {
|
|||
|
||||
public ActionIconView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorForeground});
|
||||
mDefaultColor = a.getColor(0, 0);
|
||||
final TypedArray a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color,
|
||||
android.R.attr.colorForeground});
|
||||
if (a.hasValue(0)) {
|
||||
mDefaultColor = a.getColor(0, 0);
|
||||
} else {
|
||||
mDefaultColor = a.getColor(1, 0);
|
||||
}
|
||||
setColorFilter(mDefaultColor, Mode.SRC_ATOP);
|
||||
a.recycle();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.mariotaku.twidere.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint.Align;
|
||||
|
@ -30,11 +31,20 @@ public class BadgeView extends View {
|
|||
public BadgeView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mTextPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
mTextPaint.setColor(Color.WHITE);
|
||||
final TypedArray a = context.obtainStyledAttributes(attrs,
|
||||
new int[]{android.R.attr.textColor, android.R.attr.text});
|
||||
setColor(a.getColor(0, Color.WHITE));
|
||||
setText(a.getString(1));
|
||||
mTextPaint.setTextAlign(Align.CENTER);
|
||||
mTextBounds = new Rect();
|
||||
}
|
||||
|
||||
|
||||
public void setColor(int color) {
|
||||
mTextPaint.setColor(color);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
mText = text;
|
||||
updateTextPosition();
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 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.view;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/1/16.
|
||||
*/
|
||||
public class BoundsImageView extends ImageView {
|
||||
public BoundsImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public BoundsImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public BoundsImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public BoundsImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(@NonNull Canvas canvas) {
|
||||
setFrame(getLeft(), getTop(), getRight(), getBottom());
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
}
|
|
@ -40,8 +40,8 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.ColorUtils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
import org.mariotaku.twidere.view.iface.IHomeActionButton;
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu
|
|||
if (child instanceof FrameLayout) {
|
||||
final Drawable foreground = ((FrameLayout) child).getForeground();
|
||||
if (foreground != null) {
|
||||
foreground.setColorFilter(Utils.getContrastYIQ(color, 192), Mode.MULTIPLY);
|
||||
foreground.setColorFilter(ColorUtils.getContrastYIQ(color, 192), Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ public class MainFrameLayout extends TintedStatusFrameLayout {
|
|||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPadding(int left, int top, int right, int bottom) {
|
||||
super.setPadding(left, top, right, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatusBarHeight(int height) {
|
||||
setPadding(0, height, 0, 0);
|
||||
|
|
|
@ -36,7 +36,9 @@ import android.graphics.PorterDuff.Mode;
|
|||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.SweepGradient;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.Build;
|
||||
|
@ -59,36 +61,29 @@ import java.lang.annotation.RetentionPolicy;
|
|||
*/
|
||||
public class ShapedImageView extends ImageView {
|
||||
|
||||
|
||||
@IntDef({SHAPE_CIRCLE, SHAPE_RECTANGLE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ShapeStyle {
|
||||
}
|
||||
|
||||
@ShapeStyle
|
||||
public static final int SHAPE_CIRCLE = 0x1;
|
||||
@ShapeStyle
|
||||
public static final int SHAPE_RECTANGLE = 0x2;
|
||||
|
||||
private static final int SHADOW_START_COLOR = 0x37000000;
|
||||
|
||||
private static final boolean USE_OUTLINE = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
private static final boolean OUTLINE_DRAW = false;
|
||||
|
||||
private final Matrix mMatrix;
|
||||
private final RectF mSource;
|
||||
private final RectF mDestination;
|
||||
private final RectF mTempDestination;
|
||||
private final Paint mBitmapPaint;
|
||||
private final Paint mSolidColorPaint;
|
||||
private final Paint mBorderPaint;
|
||||
private final Paint mBackgroundPaint;
|
||||
|
||||
private boolean mBorderEnabled;
|
||||
private Bitmap mShadowBitmap;
|
||||
private float mShadowRadius;
|
||||
|
||||
private int mStyle;
|
||||
private float mCornerRadius, mCornerRadiusRatio;
|
||||
private RectF mTransitionSource, mTransitionDestination;
|
||||
private int mStrokeWidth, mBorderAlpha;
|
||||
private int[] mBorderColors;
|
||||
|
||||
public ShapedImageView(Context context) {
|
||||
this(context, null, 0);
|
||||
|
@ -98,13 +93,6 @@ public class ShapedImageView extends ImageView {
|
|||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int color) {
|
||||
mBackgroundPaint.setColor(0xFF000000 | color);
|
||||
mBackgroundPaint.setAlpha(Color.alpha(color));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public ShapedImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
|
@ -118,6 +106,7 @@ public class ShapedImageView extends ImageView {
|
|||
mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mBitmapPaint.setFilterBitmap(true);
|
||||
mBitmapPaint.setDither(true);
|
||||
mSolidColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mBorderPaint.setStyle(Paint.Style.STROKE);
|
||||
|
@ -154,10 +143,6 @@ public class ShapedImageView extends ImageView {
|
|||
}
|
||||
}
|
||||
|
||||
public void setCornerRadiusRatio(float ratio) {
|
||||
mCornerRadiusRatio = ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the source bitmap and a canvas, draws the bitmap through a circular
|
||||
* mask. Only draws a circle with diameter equal to the destination width.
|
||||
|
@ -168,9 +153,19 @@ public class ShapedImageView extends ImageView {
|
|||
* @param dest The destination bound on the canvas.
|
||||
*/
|
||||
public void drawBitmapWithCircleOnCanvas(Bitmap bitmap, Canvas canvas,
|
||||
RectF source, RectF dest) {
|
||||
RectF source, @NonNull RectF dest) {
|
||||
if (bitmap == null) {
|
||||
if (getStyle() == SHAPE_CIRCLE) {
|
||||
canvas.drawCircle(dest.centerX(), dest.centerY(), Math.min(dest.width(), dest.height()) / 2f,
|
||||
mSolidColorPaint);
|
||||
} else {
|
||||
final float cornerRadius = getCalculatedCornerRadius();
|
||||
canvas.drawRoundRect(dest, cornerRadius, cornerRadius, mSolidColorPaint);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Draw bitmap through shader first.
|
||||
BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP,
|
||||
final BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP,
|
||||
Shader.TileMode.CLAMP);
|
||||
mMatrix.reset();
|
||||
|
||||
|
@ -226,9 +221,17 @@ public class ShapedImageView extends ImageView {
|
|||
mStyle = style;
|
||||
}
|
||||
|
||||
public void setBorderColors(int... colors) {
|
||||
mBorderAlpha = 0xff;
|
||||
mBorderColors = colors;
|
||||
updateBorderShader();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setBorderColor(int color) {
|
||||
mBorderPaint.setARGB(Color.alpha(color), Color.red(color), Color.green(color),
|
||||
Color.blue(color));
|
||||
mBorderAlpha = Color.alpha(color);
|
||||
mBorderColors = new int[]{color};
|
||||
updateBorderShader();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
@ -239,9 +242,22 @@ public class ShapedImageView extends ImageView {
|
|||
|
||||
public void setBorderWidth(int width) {
|
||||
mBorderPaint.setStrokeWidth(width);
|
||||
mStrokeWidth = width;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setCornerRadiusRatio(float ratio) {
|
||||
mCornerRadiusRatio = ratio;
|
||||
}
|
||||
|
||||
public void setTransitionDestination(RectF dstBounds) {
|
||||
mTransitionDestination = dstBounds;
|
||||
}
|
||||
|
||||
public void setTransitionSource(RectF srcBounds) {
|
||||
mTransitionSource = srcBounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(@NonNull Canvas canvas) {
|
||||
|
||||
|
@ -275,32 +291,25 @@ public class ShapedImageView extends ImageView {
|
|||
if (drawable.getCurrent() != null) {
|
||||
bitmapDrawable = (BitmapDrawable) drawable.getCurrent();
|
||||
}
|
||||
} else {
|
||||
} else if (drawable instanceof BitmapDrawable) {
|
||||
bitmapDrawable = (BitmapDrawable) drawable;
|
||||
} else if (drawable instanceof ColorDrawable) {
|
||||
mSolidColorPaint.setColor(((ColorDrawable) drawable).getColor());
|
||||
}
|
||||
|
||||
if (bitmapDrawable == null) {
|
||||
return;
|
||||
Bitmap bitmap = null;
|
||||
if (bitmapDrawable != null) {
|
||||
bitmap = bitmapDrawable.getBitmap();
|
||||
}
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
if (bitmap == null) {
|
||||
return;
|
||||
if (bitmap != null) {
|
||||
mSource.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
}
|
||||
|
||||
mSource.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
|
||||
drawBitmapWithCircleOnCanvas(bitmap, canvas, mSource, mDestination);
|
||||
}
|
||||
|
||||
// Then draw the border.
|
||||
if (mBorderEnabled) {
|
||||
if (getStyle() == SHAPE_CIRCLE) {
|
||||
canvas.drawCircle(mDestination.centerX(), mDestination.centerY(),
|
||||
mDestination.width() / 2f - mBorderPaint.getStrokeWidth() / 2, mBorderPaint);
|
||||
} else {
|
||||
final float radius = getCalculatedCornerRadius();
|
||||
canvas.drawRoundRect(mDestination, radius, radius, mBorderPaint);
|
||||
}
|
||||
drawBorder(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +322,15 @@ public class ShapedImageView extends ImageView {
|
|||
mBitmapPaint.setColorFilter(cf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateShadowBitmap();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
updateShadowBitmap();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -324,6 +338,13 @@ public class ShapedImageView extends ImageView {
|
|||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int color) {
|
||||
mBackgroundPaint.setColor(0xFF000000 | color);
|
||||
mBackgroundPaint.setAlpha(Color.alpha(color));
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
@Override
|
||||
public void setBackground(Drawable background) {
|
||||
|
@ -346,6 +367,37 @@ public class ShapedImageView extends ImageView {
|
|||
updateShadowBitmap();
|
||||
}
|
||||
|
||||
private void drawBorder(@NonNull final Canvas canvas) {
|
||||
final RectF transitionSrc = mTransitionSource, transitionDst = mTransitionDestination;
|
||||
if (transitionSrc != null && transitionDst != null) {
|
||||
final float progress = 1 - (mDestination.width() - transitionDst.width())
|
||||
/ (transitionSrc.width() - transitionDst.width());
|
||||
mBorderPaint.setStrokeWidth(mStrokeWidth * progress);
|
||||
mBorderPaint.setAlpha(Math.round(mBorderAlpha * progress));
|
||||
ViewCompat.setTranslationZ(this, -ViewCompat.getElevation(this) * (1 - progress));
|
||||
} else {
|
||||
mBorderPaint.setStrokeWidth(mStrokeWidth);
|
||||
mBorderPaint.setAlpha(mBorderAlpha);
|
||||
ViewCompat.setTranslationZ(this, 0);
|
||||
}
|
||||
if (getStyle() == SHAPE_CIRCLE) {
|
||||
canvas.drawCircle(mDestination.centerX(), mDestination.centerY(),
|
||||
mDestination.width() / 2f - mBorderPaint.getStrokeWidth() / 2, mBorderPaint);
|
||||
} else {
|
||||
final float radius = getCalculatedCornerRadius();
|
||||
canvas.drawRoundRect(mDestination, radius, radius, mBorderPaint);
|
||||
}
|
||||
}
|
||||
|
||||
private float getCalculatedCornerRadius() {
|
||||
if (mCornerRadiusRatio > 0) {
|
||||
return Math.min(getWidth(), getHeight()) * mCornerRadiusRatio;
|
||||
} else if (mCornerRadius > 0) {
|
||||
return mCornerRadius;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private float getCornerRadius() {
|
||||
return mCornerRadius;
|
||||
}
|
||||
|
@ -362,6 +414,7 @@ public class ShapedImageView extends ImageView {
|
|||
}
|
||||
|
||||
private void updateShadowBitmap() {
|
||||
updateBorderShader();
|
||||
if (USE_OUTLINE) return;
|
||||
final int width = getWidth(), height = getHeight();
|
||||
if (width <= 0 || height <= 0) return;
|
||||
|
@ -385,6 +438,34 @@ public class ShapedImageView extends ImageView {
|
|||
invalidate();
|
||||
}
|
||||
|
||||
private void updateBorderShader() {
|
||||
final int[] colors = mBorderColors;
|
||||
if (colors == null || colors.length == 0) {
|
||||
mBorderPaint.setShader(null);
|
||||
return;
|
||||
}
|
||||
mDestination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(),
|
||||
getHeight() - getPaddingBottom());
|
||||
final float cx = mDestination.centerX(), cy = mDestination.centerY();
|
||||
final int[] sweepColors = new int[colors.length * 2];
|
||||
final float[] positions = new float[colors.length * 2];
|
||||
for (int i = 0, j = colors.length; i < j; i++) {
|
||||
sweepColors[i * 2] = sweepColors[i * 2 + 1] = colors[i];
|
||||
positions[i * 2] = i == 0 ? 0 : i / (float) j;
|
||||
positions[i * 2 + 1] = i == j - 1 ? 1 : (i + 1) / (float) j;
|
||||
}
|
||||
final SweepGradient shader = new SweepGradient(cx, cy, sweepColors, positions);
|
||||
final Matrix matrix = new Matrix();
|
||||
matrix.setRotate(90, cx, cy);
|
||||
shader.setLocalMatrix(matrix);
|
||||
mBorderPaint.setShader(shader);
|
||||
}
|
||||
|
||||
@IntDef({SHAPE_CIRCLE, SHAPE_RECTANGLE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ShapeStyle {
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private static class CircularOutlineProvider extends ViewOutlineProvider {
|
||||
@Override
|
||||
|
@ -407,13 +488,4 @@ public class ShapedImageView extends ImageView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float getCalculatedCornerRadius() {
|
||||
if (mCornerRadiusRatio > 0) {
|
||||
return Math.min(getWidth(), getHeight()) * mCornerRadiusRatio;
|
||||
} else if (mCornerRadius > 0) {
|
||||
return mCornerRadius;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package org.mariotaku.twidere.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.MenuBar;
|
||||
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarListener;
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14-7-29.
|
||||
*/
|
||||
public class TwidereMenuBar extends MenuBar implements MenuBarListener, Constants {
|
||||
private final int mItemColor, mPopupItemColor, mHighlightColor;
|
||||
private OnMenuItemClickListener mListener;
|
||||
|
||||
public TwidereMenuBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TwidereMenuBar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
final int itemBackgroundColor = ThemeUtils.getThemeBackgroundColor(getItemViewContext());
|
||||
final int popupItemBackgroundColor = ThemeUtils.getThemeBackgroundColor(getPopupContext());
|
||||
final Resources resources = getResources();
|
||||
final int colorDark = resources.getColor(R.color.action_icon_dark);
|
||||
final int colorLight = resources.getColor(R.color.action_icon_light);
|
||||
mItemColor = Utils.getContrastYIQ(itemBackgroundColor, colorDark, colorLight);
|
||||
mPopupItemColor = Utils.getContrastYIQ(popupItemBackgroundColor, colorDark, colorLight);
|
||||
mHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserAccentColor(getContext());
|
||||
setMenuBarListener(this);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
setPopupStyleAttribute(android.R.attr.actionOverflowMenuStyle);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreShowMenu(Menu menu) {
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, mItemColor, mPopupItemColor, Mode.SRC_ATOP,
|
||||
MENU_GROUP_STATUS_SHARE, MENU_GROUP_STATUS_EXTENSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostShowMenu(Menu menu) {
|
||||
final View overflowItemView = getOverflowItemView();
|
||||
if (overflowItemView instanceof ImageView) {
|
||||
((ImageView) overflowItemView).setColorFilter(mItemColor, Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return mListener != null && mListener.onMenuItemClick(item);
|
||||
}
|
||||
}
|
|
@ -124,13 +124,14 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements OnClick
|
|||
public void displayStatus(final ParcelableStatus status, final boolean displayInReplyTo) {
|
||||
displayStatus(adapter.getContext(), adapter.getImageLoader(),
|
||||
adapter.getImageLoadingHandler(), adapter.getTwitterWrapper(),
|
||||
adapter.getProfileImageStyle(), adapter.getMediaPreviewStyle(), status, null,
|
||||
displayInReplyTo);
|
||||
adapter.getProfileImageStyle(), adapter.getMediaPreviewStyle(),
|
||||
adapter.shouldShowAccountsColor(), status, null, displayInReplyTo);
|
||||
}
|
||||
|
||||
public void displayStatus(final Context context, final ImageLoaderWrapper loader,
|
||||
final ImageLoadingHandler handler, final AsyncTwitterWrapper twitter,
|
||||
final int profileImageStyle, final int mediaPreviewStyle,
|
||||
final boolean displayAccountsColor,
|
||||
@NonNull final ParcelableStatus status,
|
||||
@Nullable final TranslationResult translation,
|
||||
final boolean displayInReplyTo) {
|
||||
|
@ -156,9 +157,11 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements OnClick
|
|||
final int typeIconRes = getUserTypeIconRes(status.user_is_verified, status.user_is_protected);
|
||||
if (typeIconRes != 0) {
|
||||
profileTypeView.setImageResource(typeIconRes);
|
||||
// profileTypeView.setBackgroundResource(typeIconRes);
|
||||
profileTypeView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileTypeView.setImageDrawable(null);
|
||||
// profileTypeView.setBackgroundResource(0);
|
||||
profileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
@ -168,6 +171,12 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements OnClick
|
|||
|
||||
final int userColor = UserColorNameUtils.getUserColor(context, status.user_id);
|
||||
itemContent.drawStart(userColor);
|
||||
|
||||
if (displayAccountsColor) {
|
||||
itemContent.drawEnd(Utils.getAccountColor(context, status.account_id));
|
||||
} else {
|
||||
itemContent.drawEnd();
|
||||
}
|
||||
profileImageView.setStyle(profileImageStyle);
|
||||
|
||||
loader.displayProfileImage(profileImageView, status.user_profile_image_url);
|
||||
|
@ -284,6 +293,13 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements OnClick
|
|||
|
||||
final int userColor = UserColorNameUtils.getUserColor(context, user_id);
|
||||
itemContent.drawStart(userColor);
|
||||
|
||||
if (adapter.shouldShowAccountsColor()) {
|
||||
itemContent.drawEnd(Utils.getAccountColor(context, account_id));
|
||||
} else {
|
||||
itemContent.drawEnd();
|
||||
}
|
||||
|
||||
profileImageView.setStyle(adapter.getProfileImageStyle());
|
||||
|
||||
loader.displayProfileImage(profileImageView, user_profile_image_url);
|
||||
|
|
|
@ -1,183 +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.view.holder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.ShortTimeView;
|
||||
|
||||
import static org.mariotaku.twidere.util.UserColorNameUtils.getDisplayName;
|
||||
import static org.mariotaku.twidere.util.Utils.getStatusTypeIconRes;
|
||||
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
|
||||
|
||||
public class StatusViewListHolder extends CardViewHolder {
|
||||
|
||||
public final ImageView my_profile_image, profile_image;
|
||||
public final ImageView image_preview;
|
||||
public final ViewGroup image_preview_container;
|
||||
public final ProgressBar image_preview_progress;
|
||||
public final TextView name, screen_name, reply_retweet_status;
|
||||
public final ShortTimeView time;
|
||||
public final TextView text;
|
||||
|
||||
private final float density;
|
||||
private final boolean is_rtl;
|
||||
public boolean show_as_gap;
|
||||
public int position;
|
||||
private boolean account_color_enabled;
|
||||
private float text_size;
|
||||
private boolean nickname_only, name_first;
|
||||
private boolean display_profile_image;
|
||||
private int card_highlight_option;
|
||||
|
||||
public StatusViewListHolder(final View view) {
|
||||
super(view);
|
||||
final Context context = getContext();
|
||||
profile_image = (ImageView) findViewById(R.id.profile_image);
|
||||
my_profile_image = (ImageView) findViewById(R.id.my_profile_image);
|
||||
image_preview = (ImageView) findViewById(R.id.image_preview);
|
||||
image_preview_progress = (ProgressBar) findViewById(R.id.media_preview_progress);
|
||||
image_preview_container = (ViewGroup) findViewById(R.id.image_preview_container);
|
||||
name = (TextView) findViewById(R.id.name);
|
||||
screen_name = (TextView) findViewById(R.id.screen_name);
|
||||
text = (TextView) findViewById(R.id.text);
|
||||
time = (ShortTimeView) findViewById(R.id.time);
|
||||
reply_retweet_status = (TextView) findViewById(R.id.reply_retweet_status);
|
||||
show_as_gap = false;
|
||||
is_rtl = Utils.isRTL(context);
|
||||
density = context.getResources().getDisplayMetrics().density;
|
||||
}
|
||||
|
||||
public void setAccountColor(final int color) {
|
||||
content.drawEnd(account_color_enabled && !show_as_gap ? color : Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
public void setAccountColorEnabled(final boolean enabled) {
|
||||
account_color_enabled = enabled && !show_as_gap;
|
||||
if (!account_color_enabled) {
|
||||
content.drawEnd(Color.TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCardHighlightOption(final int option) {
|
||||
card_highlight_option = option;
|
||||
}
|
||||
|
||||
public void setDisplayNameFirst(final boolean name_first) {
|
||||
this.name_first = name_first;
|
||||
}
|
||||
|
||||
public void setDisplayProfileImage(final boolean display) {
|
||||
display_profile_image = display;
|
||||
}
|
||||
|
||||
public void setHighlightColor(final int color) {
|
||||
final boolean line = (card_highlight_option & VALUE_CARD_HIGHLIGHT_OPTION_CODE_LINE) != 0;
|
||||
final boolean bg = (card_highlight_option & VALUE_CARD_HIGHLIGHT_OPTION_CODE_BACKGROUND) != 0;
|
||||
content.drawTop(!show_as_gap && line ? color : Color.TRANSPARENT);
|
||||
content.drawBackground(!show_as_gap && bg && color != 0 ? 0x1A000000 | 0x00FFFFFF & color : Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
public void setIsMyStatus(final boolean my_status) {
|
||||
profile_image.setVisibility(my_status ? View.GONE : View.VISIBLE);
|
||||
my_profile_image.setVisibility(my_status ? View.VISIBLE : View.GONE);
|
||||
final MarginLayoutParams lp = (MarginLayoutParams) time.getLayoutParams();
|
||||
if (is_rtl) {
|
||||
lp.leftMargin = (int) (my_status ? 6 * density : 0);
|
||||
} else {
|
||||
lp.rightMargin = (int) (my_status ? 6 * density : 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIsReplyRetweet(final boolean is_reply, final boolean is_retweet) {
|
||||
reply_retweet_status.setVisibility(is_retweet || is_reply ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public void setNicknameOnly(final boolean nickname_only) {
|
||||
this.nickname_only = nickname_only;
|
||||
}
|
||||
|
||||
public void setReplyTo(final long user_id, final String name, final String screen_name) {
|
||||
final String display_name = UserColorNameUtils.getDisplayName(getContext(), user_id, name, screen_name, name_first, nickname_only,
|
||||
false);
|
||||
reply_retweet_status.setText(getString(R.string.in_reply_to_name, display_name));
|
||||
reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_conversation, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void setRetweetedBy(final long count, final long user_id, final String name, final String screen_name) {
|
||||
final String display_name = UserColorNameUtils.getDisplayName(getContext(), user_id, name, screen_name, name_first, nickname_only,
|
||||
false);
|
||||
reply_retweet_status.setText(count > 1 ? getString(R.string.retweeted_by_name_with_count, display_name, count - 1)
|
||||
: getString(R.string.retweeted_by_name, display_name));
|
||||
reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_retweet, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void setShowAsGap(final boolean show_gap) {
|
||||
show_as_gap = show_gap;
|
||||
if (content != null) {
|
||||
}
|
||||
// if (item_menu != null) {
|
||||
// item_menu.setVisibility(show_gap ? View.GONE : View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
public void setStatusType(final boolean is_favorite, final boolean has_location, final boolean has_media,
|
||||
final boolean is_possibly_sensitive) {
|
||||
final int res = getStatusTypeIconRes(is_favorite, has_location, has_media, is_possibly_sensitive);
|
||||
time.setCompoundDrawablesWithIntrinsicBounds(0, 0, res, 0);
|
||||
}
|
||||
|
||||
public boolean setTextSize(final float text_size) {
|
||||
if (this.text_size == text_size) return false;
|
||||
this.text_size = text_size;
|
||||
text.setTextSize(text_size);
|
||||
name.setTextSize(text_size);
|
||||
screen_name.setTextSize(text_size * 0.75f);
|
||||
time.setTextSize(text_size * 0.65f);
|
||||
reply_retweet_status.setTextSize(text_size * 0.65f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setUserColor(final int... colors) {
|
||||
content.drawStart(show_as_gap ? null : colors);
|
||||
}
|
||||
|
||||
public void setUserType(final boolean isVerified, final boolean isProtected) {
|
||||
// if (display_profile_image) {
|
||||
// profile_image.setUserType(isVerified, isProtected);
|
||||
// my_profile_image.setUserType(isVerified, isProtected);
|
||||
// name.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
// } else {
|
||||
// profile_image.setUserType(false, false);
|
||||
// my_profile_image.setUserType(false, false);
|
||||
name.setCompoundDrawablesWithIntrinsicBounds(0, 0, getUserTypeIconRes(isVerified, isProtected), 0);
|
||||
// }
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2015 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/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.SquareFrameLayout
|
||||
style="?android:actionButtonStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_mlarge"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:paddingTop="@dimen/element_spacing_normal"
|
||||
tools:layout_height="?actionBarSize"
|
||||
tools:showIn="@layout/menu_compose">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/account_profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
app:sivBorder="true"
|
||||
app:sivBorderWidth="1.5dp"
|
||||
tools:src="@drawable/ic_profile_image_default"/>
|
||||
|
||||
<org.mariotaku.twidere.view.BadgeView
|
||||
android:id="@+id/accounts_count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
</org.mariotaku.twidere.view.SquareFrameLayout>
|
|
@ -1,53 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/send"
|
||||
style="?android:actionButtonStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/send"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_large"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextCountView
|
||||
android:id="@+id/status_text_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/element_size_small"
|
||||
android:textAppearance="?android:textAppearanceSmall"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/send"
|
||||
android:cropToPadding="false"
|
||||
android:padding="@dimen/element_spacing_xsmall"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_action_send"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~ Copyright (C) 2012-2015 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
|
||||
|
@ -17,12 +17,15 @@
|
|||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ComposeSelectAccountButton
|
||||
android:id="@+id/select_account"
|
||||
style="?android:actionButtonStyle"
|
||||
<org.mariotaku.twidere.view.TabPagerIndicator
|
||||
android:id="@+id/main_tabs"
|
||||
style="?android:actionBarStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:padding="@dimen/element_spacing_small"/>
|
||||
app:tabExpandEnabled="true"
|
||||
app:tabHorizontalPadding="@dimen/element_spacing_normal"
|
||||
tools:layout_height="?actionBarSize"/>
|
|
@ -23,7 +23,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle"
|
||||
tools:context=".activity.SelectAccountActivity">
|
||||
|
||||
<ListView
|
||||
|
@ -32,12 +34,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/select_account_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/select_account_buttons"
|
||||
style="?android:buttonBarStyle"
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:showDividers="middle"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
|
@ -32,11 +34,6 @@
|
|||
<include layout="@layout/layout_api_editor"/>
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
style="?android:borderlessButtonStyle"
|
||||
|
|
|
@ -37,18 +37,6 @@
|
|||
android:layout_weight="1"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/account_selector"
|
||||
android:layout_width="@dimen/element_size_mlarge"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignBottom="@+id/edit_text_container"
|
||||
android:layout_alignTop="@+id/edit_text_container"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_msmall"
|
||||
android:paddingRight="@dimen/element_spacing_msmall"
|
||||
android:paddingTop="@dimen/element_spacing_normal"/>
|
||||
|
||||
<org.mariotaku.dynamicgridview.DynamicGridView
|
||||
android:id="@+id/media_thumbnail_preview"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -66,8 +54,6 @@
|
|||
android:id="@+id/edit_text_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_minus_small"
|
||||
android:layout_toRightOf="@+id/account_selector"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.StatusComposeEditText
|
||||
|
@ -81,13 +67,34 @@
|
|||
android:imeOptions="actionDone"
|
||||
android:minLines="10"/>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/account_selector_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignBottom="@+id/edit_text_container"
|
||||
android:layout_alignLeft="@+id/edit_text_container"
|
||||
android:layout_alignRight="@+id/edit_text_container"
|
||||
android:layout_alignTop="@+id/edit_text_container"
|
||||
android:visibility="gone">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/account_selector"
|
||||
android:layout_width="?actionBarSize"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="left"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:overScrollMode="never"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"/>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:panelBackground">
|
||||
android:background="?android:colorBackground">
|
||||
|
||||
<include layout="@layout/activity_compose_bottombar"/>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/compose_bottombar"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:baselineAligned="false"
|
||||
|
@ -31,29 +30,44 @@
|
|||
android:orientation="horizontal"
|
||||
android:showDividers="middle">
|
||||
|
||||
<!--<org.mariotaku.twidere.view.ComposeSelectAccountButton-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:layout_weight="0"-->
|
||||
<!--android:padding="@dimen/element_spacing_small"/>-->
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/bottom_menu_container"
|
||||
android:layout_width="0dp"
|
||||
<android.support.v7.widget.ActionMenuView
|
||||
android:id="@+id/menu_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:fadeScrollbars="false"
|
||||
android:paddingRight="@dimen/element_spacing_normal">
|
||||
android:background="@null"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
android:id="@+id/menu_bar"
|
||||
<LinearLayout
|
||||
android:id="@+id/send"
|
||||
style="?android:actionButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/send"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_large"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextCountView
|
||||
android:id="@+id/status_text_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:background="@null"
|
||||
app:maxActionItems="@integer/max_action_buttons_bottom"/>
|
||||
</HorizontalScrollView>
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/element_size_small"
|
||||
android:textAppearance="?android:textAppearanceSmall"/>
|
||||
|
||||
<include layout="@layout/action_item_compose_send"/>
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/send"
|
||||
android:cropToPadding="false"
|
||||
android:padding="@dimen/element_spacing_xsmall"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_action_send"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -23,7 +23,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle"
|
||||
tools:context=".activity.EditCustomTabActivity">
|
||||
|
||||
<ScrollView
|
||||
|
@ -145,12 +147,6 @@
|
|||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:layout_weight="0"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
style="?android:borderlessButtonStyle"
|
||||
|
|
|
@ -38,14 +38,23 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.TabPagerIndicator
|
||||
android:id="@+id/main_tabs"
|
||||
style="?android:actionBarStyle"
|
||||
<org.mariotaku.twidere.view.TwidereToolbar
|
||||
android:id="@+id/actionbar"
|
||||
style="?actionBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:layout_weight="0"
|
||||
app:tabExpandEnabled="true"
|
||||
app:tabHorizontalPadding="@dimen/element_spacing_normal"/>
|
||||
android:layout_height="?actionBarSize"
|
||||
app:contentInsetEnd="0dp"
|
||||
app:contentInsetStart="0dp">
|
||||
|
||||
<org.mariotaku.twidere.view.TabPagerIndicator
|
||||
android:id="@+id/main_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
app:tabExpandEnabled="true"
|
||||
app:tabHorizontalPadding="@dimen/element_spacing_normal"/>
|
||||
|
||||
</org.mariotaku.twidere.view.TwidereToolbar>
|
||||
|
||||
<View
|
||||
android:id="@+id/actionbar_overlay"
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
android:id="@+id/user_lists_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle"
|
||||
android:visibility="gone">
|
||||
|
||||
<ListView
|
||||
|
@ -46,11 +48,6 @@
|
|||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/create_list"
|
||||
style="?android:borderlessButtonStyle"
|
||||
|
@ -66,7 +63,9 @@
|
|||
android:id="@+id/users_list_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle"
|
||||
tools:context=".activity.UserListSelectorActivity">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -106,10 +105,6 @@
|
|||
android:src="@android:drawable/ic_menu_search"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
|
|
|
@ -1,223 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelLinearLayout
|
||||
android:id="@+id/content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/element_spacing_small"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_small">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_large"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/icon_size_card_list_item"
|
||||
android:layout_height="@dimen/icon_size_card_list_item"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ShortTimeView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:drawablePadding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/my_profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/icon_size_card_list_item"
|
||||
android:layout_height="@dimen/icon_size_card_list_item"
|
||||
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/your_profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ImagePreviewContainer
|
||||
android:id="@+id/image_preview_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ForegroundImageView
|
||||
android:id="@+id/image_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/media_preview_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_large"/>
|
||||
</org.mariotaku.twidere.view.ImagePreviewContainer>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/reply_retweet_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="@dimen/element_spacing_small"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/activity_profile_image_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_small">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_profile_image_1"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_profile_image_2"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_profile_image_3"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_profile_image_4"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/activity_profile_image_5"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/activity_profile_image_more_number"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelLinearLayout>
|
|
@ -1,235 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelFrameLayout
|
||||
android:id="@+id/content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/element_spacing_small"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_small">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/icon_size_card_list_item"
|
||||
android:layout_height="@dimen/icon_size_card_list_item"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginRight="@dimen/element_spacing_normal"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/my_profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/icon_size_card_list_item"
|
||||
android:layout_height="@dimen/icon_size_card_list_item"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||
android:contentDescription="@string/your_profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/name_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/time_frame"
|
||||
android:layout_toRightOf="@id/profile_image">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/time_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/name_frame"
|
||||
android:layout_alignTop="@+id/name_frame"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/my_profile_image"
|
||||
android:paddingLeft="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.ShortTimeView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:drawablePadding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</FrameLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ImagePreviewContainer
|
||||
android:id="@+id/image_preview_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/name_frame"
|
||||
android:layout_alignRight="@+id/time_frame"
|
||||
android:layout_below="@+id/name_frame"
|
||||
android:paddingTop="@dimen/element_spacing_small"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ForegroundImageView
|
||||
android:id="@+id/image_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/media_preview_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_large"/>
|
||||
</org.mariotaku.twidere.view.ImagePreviewContainer>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/name_frame"
|
||||
android:layout_alignRight="@+id/time_frame"
|
||||
android:layout_below="@+id/image_preview_container"
|
||||
android:paddingTop="@dimen/element_spacing_small"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/reply_retweet_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/name_frame"
|
||||
android:layout_alignRight="@+id/time_frame"
|
||||
android:layout_below="@+id/text"
|
||||
android:drawablePadding="4dp"
|
||||
android:paddingTop="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/activity_profile_image_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/name_frame"
|
||||
android:layout_alignRight="@+id/time_frame"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_below="@+id/reply_retweet_status"
|
||||
android:layout_toRightOf="@id/profile_image"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/activity_profile_image_1"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/activity_profile_image_2"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/activity_profile_image_3"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/activity_profile_image_4"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/activity_profile_image_5"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="@dimen/profile_image_size_activity_small"
|
||||
android:layout_margin="2dp"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/activity_profile_image_more_number"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
|
|
@ -46,7 +46,7 @@
|
|||
android:layout_marginBottom="@dimen/element_spacing_small"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:layout_marginTop="@dimen/element_spacing_small"
|
||||
android:layout_toLeftOf="@id/reply_retweet_status"
|
||||
android:layout_toLeftOf="@+id/reply_retweet_status"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
|
@ -91,7 +91,7 @@
|
|||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<ImageView
|
||||
<org.mariotaku.twidere.view.BoundsImageView
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="@dimen/icon_size_profile_type"
|
||||
android:layout_height="@dimen/icon_size_profile_type"
|
||||
|
|
|
@ -78,15 +78,13 @@
|
|||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<ImageView
|
||||
<org.mariotaku.twidere.view.BoundsImageView
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="@dimen/icon_size_profile_type"
|
||||
android:layout_height="@dimen/icon_size_profile_type"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_marginBottom="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_minus_normal"
|
||||
android:scaleType="centerInside"/>
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/status_content"
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/pages_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
@ -52,12 +53,29 @@
|
|||
android:layout_below="@id/view_pager_tabs"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pages_error"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Blocked"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/pages_error_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/pages_error_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:color="?android:textColorSecondary"
|
||||
android:src="@drawable/ic_error_generic"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pages_error_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:textAppearanceMedium"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2013 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
android:id="@+id/menu_bar"
|
||||
style="?android:actionBarSplitStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:max="@integer/max_action_buttons_bottom"/>
|
|
@ -1,78 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.ExtendedFrameLayout
|
||||
android:id="@+id/details_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionBarSplitThemedContainer
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/fragment_details_bottombar"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/details_load_progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/error_retry_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/retry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:minWidth="84dp"
|
||||
android:text="@string/retry"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -18,19 +18,22 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle"
|
||||
tools:context=".activity.DonateActivity">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/table_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/divider"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center">
|
||||
|
||||
<TableRow
|
||||
|
@ -82,19 +85,12 @@
|
|||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:layout_above="@+id/donate"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/donate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/button_bar_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_weight="0"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:text="@string/donate"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -22,8 +22,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.mariotaku.twidere.view.ExtendedFrameLayout
|
||||
android:id="@+id/details_container"
|
||||
|
|
|
@ -309,11 +309,9 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
<android.support.v7.widget.ActionMenuView
|
||||
android:id="@+id/menu_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:splitMotionEvents="false"
|
||||
app:maxActionItems="@integer/max_action_buttons_bottom"/>
|
||||
android:layout_height="?android:actionBarSize"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -102,254 +102,11 @@
|
|||
android:layout_above="@id/profile_name_container"
|
||||
android:background="@drawable/shadow_top"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card"
|
||||
<FrameLayout
|
||||
android:id="@+id/profile_details_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/profile_name_container"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="@dimen/corner_radius_card"
|
||||
app:cardElevation="@dimen/elevation_card">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/description_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/description"
|
||||
android:visibility="gone"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/location"
|
||||
android:visibility="gone"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/url_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:visibility="gone"
|
||||
android:singleLine="true"
|
||||
android:text="@string/url"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/created_at_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/created_at"
|
||||
android:visibility="gone"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/created_at"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="@color/divider_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_button_size"
|
||||
android:baselineAligned="false"
|
||||
android:divider="?android:dividerHorizontal"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/followers_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/followers_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/followers"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/friends_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/friends_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/following"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listed_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/listed_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/listed"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_content_fragment_common"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
android:layout_below="@id/profile_name_container"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
|
@ -361,15 +118,13 @@
|
|||
android:contentDescription="@string/profile_image"
|
||||
android:src="@drawable/ic_profile_image_default"/>
|
||||
|
||||
<ImageView
|
||||
<org.mariotaku.twidere.view.BoundsImageView
|
||||
android:id="@+id/profile_type"
|
||||
style="@style/Widget.ProfileType"
|
||||
android:layout_width="@dimen/icon_size_profile_type_user_profile"
|
||||
android:layout_height="@dimen/icon_size_profile_type_user_profile"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:layout_marginBottom="@dimen/element_spacing_minus_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_minus_msmall"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.AssetFontTextView
|
||||
|
|
|
@ -35,43 +35,28 @@
|
|||
app:cardCornerRadius="@dimen/corner_radius_card"
|
||||
app:cardElevation="@dimen/elevation_card">
|
||||
|
||||
<LinearLayout
|
||||
<org.mariotaku.twidere.view.ColorLabelLinearLayout
|
||||
android:id="@+id/user_list_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/profile"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_card_details"
|
||||
android:layout_height="@dimen/icon_size_card_details"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@drawable/ic_profile_image_default"/>
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/profile_image"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/element_spacing_normal">
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/list_name"
|
||||
|
@ -88,22 +73,33 @@
|
|||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/icon_size_card_details"
|
||||
android:layout_height="@dimen/icon_size_card_details"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@drawable/ic_profile_image_default"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
android:background="?android:dividerVertical"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="@string/sample_status_text"/>
|
||||
</LinearLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelLinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
</FrameLayout>
|
|
@ -22,7 +22,9 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
|
@ -35,12 +37,6 @@
|
|||
android:textSize="@dimen/text_size_wizard_title"
|
||||
android:textStyle="italic"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#40808080"
|
||||
android:padding="@dimen/element_spacing_normal"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/progress_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/element_spacing_large">
|
||||
android:padding="@dimen/element_spacing_large"
|
||||
tools:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
style="?android:progressBarStyleLarge"
|
||||
|
|
|
@ -63,6 +63,6 @@
|
|||
android:gravity="center"
|
||||
android:padding="@dimen/element_spacing_xsmall"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
android:textColor="@android:color/white"/>
|
||||
|
||||
</view>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2015 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/>.
|
||||
-->
|
||||
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="@dimen/corner_radius_card"
|
||||
app:cardElevation="@dimen/elevation_card">
|
||||
|
||||
<include layout="@layout/layout_user_details_common"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
|
@ -0,0 +1,267 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2015 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/>.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/description_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/description"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="Line 1\nLine 2\nLine 3"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/location"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="Zhengzhou China"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/url_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/url"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.HandleSpanClickTextView
|
||||
android:id="@+id/url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="mariotaku.org"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/created_at_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:text="@string/created_at"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/created_at"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
tools:text="July 18, 2009 17:00 (20 tweets per day)"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="?android:dividerVertical"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_button_size"
|
||||
android:baselineAligned="false"
|
||||
android:divider="?android:dividerHorizontal"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/followers_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/followers_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/followers"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/friends_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/friends_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/following"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listed_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/listed_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/listed"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_content_fragment_common"/>
|
||||
|
||||
</merge>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2015 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/>.
|
||||
-->
|
||||
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/card"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<include layout="@layout/layout_user_details_common"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
|
@ -83,35 +83,4 @@
|
|||
android:layout_weight="0"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--<View-->
|
||||
<!--android:id="@+id/profile_divider"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="0.4dp"-->
|
||||
<!--android:layout_below="@+id/profile_container"-->
|
||||
<!--android:layout_margin="@dimen/element_spacing_small"-->
|
||||
<!--android:background="#40808080"/>-->
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_below="@+id/profile_divider"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:orientation="horizontal"-->
|
||||
<!--android:padding="@dimen/element_spacing_small">-->
|
||||
|
||||
<!--<org.mariotaku.twidere.view.themed.ThemedTextView-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:text="@string/show_in_timeline"-->
|
||||
<!--android:textAppearance="?android:textAppearanceMedium"-->
|
||||
<!--android:textSize="@dimen/accounts_drawer_switch_label_size"/>-->
|
||||
|
||||
<!--<org.mariotaku.twidere.view.themed.ThemedSwitch-->
|
||||
<!--android:id="@+id/toggle"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="right"/>-->
|
||||
<!--</LinearLayout>-->
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
|
@ -22,7 +22,9 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:divider="?android:dividerVertical"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -82,17 +84,13 @@
|
|||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.2dp"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="@dimen/button_bar_height"
|
||||
android:divider="?android:dividerHorizontal"
|
||||
android:orientation="horizontal"
|
||||
android:showDividers="middle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/accept"
|
||||
|
@ -103,11 +101,6 @@
|
|||
android:gravity="center"
|
||||
android:text="@string/accept_permission_request"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0.2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/deny"
|
||||
style="?android:borderlessButtonStyle"
|
||||
|
|
|
@ -38,9 +38,5 @@
|
|||
android:icon="@drawable/ic_action_delete"
|
||||
android:title="@string/delete"
|
||||
android:visible="false"/>
|
||||
<item
|
||||
android:id="@id/multi_select"
|
||||
android:icon="@drawable/ic_action_checked"
|
||||
android:title="@string/multi_select"/>
|
||||
|
||||
</menu>
|
|
@ -1,22 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@id/select_account"
|
||||
android:icon="@drawable/ic_action_accounts"
|
||||
android:title="@string/select_accounts"
|
||||
app:actionProviderClass="org.mariotaku.twidere.menu.ComposeAccountActionProvider"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@id/take_photo"
|
||||
android:icon="@drawable/ic_action_camera"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/take_photo"/>
|
||||
android:title="@string/take_photo"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@id/add_image"
|
||||
android:icon="@drawable/ic_action_gallery"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/add_image"/>
|
||||
android:title="@string/add_image"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/media_menu"
|
||||
android:icon="@drawable/ic_action_gallery"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/media"
|
||||
android:visible="false">
|
||||
android:visible="false"
|
||||
app:showAsAction="always">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/take_photo_sub_item"
|
||||
|
@ -40,20 +47,21 @@
|
|||
<item
|
||||
android:id="@id/view"
|
||||
android:icon="@drawable/ic_action_reply"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/original_status"
|
||||
android:visible="false"/>
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@id/add_location"
|
||||
android:checkable="true"
|
||||
android:enabled="false"
|
||||
android:icon="@drawable/ic_action_my_location"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/location"/>
|
||||
android:title="@string/location"
|
||||
android:visible="false"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@id/drafts"
|
||||
android:icon="@drawable/ic_action_draft"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/drafts"/>
|
||||
android:title="@string/drafts"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@id/add"
|
||||
android:icon="@drawable/ic_action_add"
|
||||
android:showAsAction="always"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/add_rule"/>
|
||||
<item
|
||||
android:id="@+id/enable_in_home_timeline"
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@id/progress"
|
||||
android:actionLayout="@layout/action_item_home_progress_smartbar"
|
||||
android:showAsAction="always"
|
||||
android:title="@string/progress"/>
|
||||
android:title="@string/progress"
|
||||
app:actionLayout="@layout/action_item_home_progress_smartbar"
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@id/actions"
|
||||
android:icon="@drawable/ic_action_status_compose"
|
||||
android:showAsAction="always"
|
||||
android:title="@string/compose"/>
|
||||
android:title="@string/compose"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
</menu>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue