1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-02 17:56:56 +01:00

removed unused code

fixed 'original status' span in quotes
This commit is contained in:
Mariotaku Lee 2015-06-25 17:22:55 +08:00
parent 3b36188f29
commit 86f3584139
16 changed files with 491 additions and 472 deletions

View File

@ -23,15 +23,29 @@ package org.mariotaku.twidere.model;
* Created by mariotaku on 15/6/24. * Created by mariotaku on 15/6/24.
*/ */
public enum RequestType { public enum RequestType {
API("api"), MEDIA("media"), USAGE_STATISTICS("usage_statistics"); OTHER("other", 0), API("api", 1), MEDIA("media", 2), USAGE_STATISTICS("usage_statistics", 3);
private final int value;
private final String name;
public String getName() { public String getName() {
return name; return name;
} }
private final String name; public int getValue() {
return value;
}
RequestType(String name) { RequestType(String name, int value) {
this.name = name; this.name = name;
this.value = value;
}
public static int getValue(String name) {
if ("api".equalsIgnoreCase(name)) return API.getValue();
else if ("media".equalsIgnoreCase(name)) return MEDIA.getValue();
else if ("usage_statistics".equalsIgnoreCase(name)) return USAGE_STATISTICS.getValue();
return OTHER.getValue();
} }
} }

View File

@ -1,11 +1,11 @@
/** /**
* This is free and unencumbered software released into the public domain. * This is free and unencumbered software released into the public domain.
* * <p/>
* Anyone is free to copy, modify, publish, use, compile, sell, or * Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled * distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any * binary, for any purpose, commercial or non-commercial, and by any
* means. * means.
* * <p/>
* In jurisdictions that recognize copyright laws, the author or authors * In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the * of this software dedicate any and all copyright interest in the
* software to the public domain. We make this dedication for the benefit * software to the public domain. We make this dedication for the benefit
@ -13,7 +13,7 @@
* successors. We intend this dedication to be an overt act of * successors. We intend this dedication to be an overt act of
* relinquishment in perpetuity of all present and future rights to this * relinquishment in perpetuity of all present and future rights to this
* software under copyright law. * software under copyright law.
* <p/>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@ -21,7 +21,7 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
* * <p/>
* For more information, please refer to <http://unlicense.org/> * For more information, please refer to <http://unlicense.org/>
*/ */
@ -74,6 +74,19 @@ public class Expression implements SQLLang {
return new Expression(String.format(Locale.ROOT, "%s > %d", l, r)); return new Expression(String.format(Locale.ROOT, "%s > %d", l, r));
} }
public static Expression greaterEquals(final String l, final long r) {
return new Expression(String.format(Locale.ROOT, "%s >= %d", l, r));
}
public static Expression lesserEquals(final String l, final long r) {
return new Expression(String.format(Locale.ROOT, "%s <= %d", l, r));
}
public static Expression lesserThan(final String l, final long r) {
return new Expression(String.format(Locale.ROOT, "%s < %d", l, r));
}
public static Expression in(final Column column, final Selectable in) { public static Expression in(final Column column, final Selectable in) {
return new Expression(String.format("%s IN(%s)", column.getSQL(), in.getSQL())); return new Expression(String.format("%s IN(%s)", column.getSQL(), in.getSQL()));
} }
@ -129,7 +142,6 @@ public class Expression implements SQLLang {
} }
public static Expression like(final Column column, final SQLLang expression) { public static Expression like(final Column column, final SQLLang expression) {
return new Expression(String.format(Locale.ROOT, "%s LIKE %s", column.getSQL(), expression.getSQL())); return new Expression(String.format(Locale.ROOT, "%s LIKE %s", column.getSQL(), expression.getSQL()));
} }

View File

@ -0,0 +1,124 @@
/*
* 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.model;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import com.db.chart.model.BarSet;
import com.db.chart.model.ChartSet;
import org.mariotaku.querybuilder.Expression;
import org.mariotaku.twidere.preference.NetworkUsageSummaryPreferences;
import org.mariotaku.twidere.provider.TwidereDataStore;
import org.mariotaku.twidere.util.MathUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* Created by mariotaku on 15/6/25.
*/
public class NetworkUsageInfo {
private final double totalSent;
private final double totalReceived;
private final ArrayList<ChartSet> chartData;
private final double dayMax;
public NetworkUsageInfo(ArrayList<ChartSet> chartData, double totalReceived, double totalSent, double dayMax) {
this.chartData = chartData;
this.totalReceived = totalReceived;
this.totalSent = totalSent;
this.dayMax = dayMax;
}
public static NetworkUsageInfo get(Context context, Date start, Date end) {
final ContentResolver cr = context.getContentResolver();
final long startTime = TimeUnit.HOURS.convert(start.getTime(), TimeUnit.MILLISECONDS);
final long endTime = TimeUnit.HOURS.convert(end.getTime(), TimeUnit.MILLISECONDS);
final Expression where = Expression.and(Expression.greaterEquals(TwidereDataStore.NetworkUsages.TIME_IN_HOURS, startTime),
Expression.lesserThan(TwidereDataStore.NetworkUsages.TIME_IN_HOURS, endTime));
final int days = (int) TimeUnit.DAYS.convert(endTime - startTime, TimeUnit.HOURS);
final Cursor c = cr.query(TwidereDataStore.NetworkUsages.CONTENT_URI, TwidereDataStore.NetworkUsages.COLUMNS,
where.getSQL(), null, TwidereDataStore.NetworkUsages.TIME_IN_HOURS);
final int idxDate = c.getColumnIndex(TwidereDataStore.NetworkUsages.TIME_IN_HOURS);
final int idxSent = c.getColumnIndex(TwidereDataStore.NetworkUsages.KILOBYTES_SENT);
final int idxReceived = c.getColumnIndex(TwidereDataStore.NetworkUsages.KILOBYTES_RECEIVED);
final int idxType = c.getColumnIndex(TwidereDataStore.NetworkUsages.REQUEST_TYPE);
final double[][] usageArray = new double[days][RequestType.values().length];
double totalReceived = 0, totalSent = 0;
c.moveToFirst();
while (!c.isAfterLast()) {
final long hours = c.getLong(idxDate);
final int idx = (int) TimeUnit.DAYS.convert((hours - startTime), TimeUnit.HOURS);
final double sent = c.getDouble(idxSent);
final double received = c.getDouble(idxReceived);
final String type = c.getString(idxType);
usageArray[idx][RequestType.getValue(type)] += (sent + received);
totalReceived += received;
totalSent += sent;
c.moveToNext();
}
c.close();
final BarSet apiSet = new BarSet();
final BarSet mediaSet = new BarSet();
final BarSet usageStatisticsSet = new BarSet();
double dayMax = 0;
for (int i = 0; i < days; i++) {
String day = String.valueOf(i + 1);
final double[] dayUsage = usageArray[i];
apiSet.addBar(day, (float) dayUsage[RequestType.API.getValue()]);
mediaSet.addBar(day, (float) dayUsage[RequestType.MEDIA.getValue()]);
usageStatisticsSet.addBar(day, (float) dayUsage[RequestType.USAGE_STATISTICS.getValue()]);
dayMax = Math.max(dayMax, MathUtils.sum(dayUsage));
}
apiSet.setColor(Color.RED);
mediaSet.setColor(Color.GREEN);
usageStatisticsSet.setColor(Color.BLUE);
final ArrayList<ChartSet> data = new ArrayList<>();
data.add(apiSet);
data.add(mediaSet);
data.add(usageStatisticsSet);
return new NetworkUsageInfo(data, totalReceived, totalSent, dayMax);
}
public double getDayMax() {
return dayMax;
}
public double getTotalSent() {
return totalSent;
}
public double getTotalReceived() {
return totalReceived;
}
public ArrayList<ChartSet> getChartData() {
return chartData;
}
}

View File

@ -0,0 +1,119 @@
/*
* 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.preference;
import android.content.Context;
import android.preference.Preference;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.db.chart.model.ChartSet;
import com.db.chart.view.AxisController;
import com.db.chart.view.StackBarChartView;
import com.desmond.asyncmanager.AsyncManager;
import com.desmond.asyncmanager.TaskRunnable;
import org.apache.commons.lang3.tuple.Triple;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.model.NetworkUsageInfo;
import org.mariotaku.twidere.util.Utils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
/**
* Created by mariotaku on 15/6/24.
*/
public class NetworkUsageSummaryPreferences extends Preference {
private StackBarChartView mChartView;
private NetworkUsageInfo mUsage;
private TextView mTotalUsage;
public NetworkUsageSummaryPreferences(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setLayoutResource(R.layout.layout_preference_network_usage);
getUsageInfo();
}
public NetworkUsageSummaryPreferences(Context context, AttributeSet attrs) {
this(context, attrs, android.R.attr.preferenceStyle);
}
public NetworkUsageSummaryPreferences(Context context) {
this(context, null);
}
@Override
protected View onCreateView(ViewGroup parent) {
final View view = super.onCreateView(parent);
mChartView = (StackBarChartView) view.findViewById(R.id.chart);
mTotalUsage = (TextView) view.findViewById(R.id.total_usage);
mChartView.setXLabels(AxisController.LabelPosition.NONE);
mChartView.setYLabels(AxisController.LabelPosition.NONE);
return view;
}
private void getUsageInfo() {
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance().getActualMinimum(Calendar.DAY_OF_MONTH));
final Date start = cal.getTime();
cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH));
final Date end = cal.getTime();
TaskRunnable<Triple<Context, Date, Date>, NetworkUsageInfo, NetworkUsageSummaryPreferences> task;
task = new TaskRunnable<Triple<Context, Date, Date>, NetworkUsageInfo, NetworkUsageSummaryPreferences>() {
@Override
public NetworkUsageInfo doLongOperation(Triple<Context, Date, Date> params) throws InterruptedException {
return NetworkUsageInfo.get(params.getLeft(), params.getMiddle(), params.getRight());
}
@Override
public void callback(NetworkUsageSummaryPreferences handler, NetworkUsageInfo result) {
handler.setUsage(result);
}
};
task.setResultHandler(this);
task.setParams(Triple.of(getContext(), start, end));
AsyncManager.runBackgroundTask(task);
}
private void setUsage(NetworkUsageInfo usage) {
mUsage = usage;
notifyChanged();
}
@Override
protected void onBindView(@NonNull View view) {
super.onBindView(view);
final NetworkUsageInfo usage = mUsage;
if (usage == null) return;
final ArrayList<ChartSet> chartData = usage.getChartData();
if (mChartView.getData() != chartData) {
mChartView.addData(chartData);
mChartView.show();
}
mTotalUsage.setText(Utils.calculateProperSize((usage.getTotalSent() + usage.getTotalReceived()) * 1024));
}
}

View File

@ -1,177 +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.preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.preference.Preference;
import android.support.v4.view.ViewCompat;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.CardView;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.InflateException;
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.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.view.iface.IExtendedView;
import org.mariotaku.twidere.view.iface.IExtendedView.TouchInterceptor;
import java.lang.reflect.InvocationTargetException;
import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
import static org.mariotaku.twidere.util.Utils.formatToLongTimeString;
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
public class ThemePreviewPreference extends Preference implements Constants, OnSharedPreferenceChangeListener {
public ThemePreviewPreference(final Context context) {
this(context, null);
}
public ThemePreviewPreference(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public ThemePreviewPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
prefs.registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(final SharedPreferences preferences, final String key) {
if (KEY_THEME.equals(key) || KEY_THEME_BACKGROUND.equals(key) || KEY_THEME_BACKGROUND_ALPHA.equals(key)
|| KEY_THEME_COLOR.equals(key)) {
notifyChanged();
}
}
@Override
protected View onCreateView(final ViewGroup parent) {
final Context context = getContext();
final int themeResource = ThemeUtils.getNoActionBarThemeResource(context);
final Context theme = new ContextThemeWrapper(context, themeResource);
final LayoutInflater inflater = LayoutInflater.from(theme);
try {
final View view = inflater.inflate(R.layout.theme_preview, parent, false);
setPreviewView(theme, view.findViewById(R.id.theme_preview_content), themeResource);
return view;
} catch (InflateException e) {
if (e.getCause() instanceof InvocationTargetException) {
e.getCause().getCause().printStackTrace();
}
throw e;
}
}
private static void setPreviewView(final Context context, final View view, final int themeRes) {
if (view instanceof IExtendedView) {
((IExtendedView) view).setTouchInterceptor(new DummyTouchInterceptor());
}
final View windowBackgroundView = view.findViewById(R.id.theme_preview_window_background);
final View windowContentOverlayView = view.findViewById(R.id.theme_preview_window_content_overlay);
final View actionBarOverlay = view.findViewById(R.id.actionbar_overlay);
final Toolbar actionBarView = (Toolbar) view.findViewById(R.id.action_bar);
final ActionMenuView menuBar = (ActionMenuView) view.findViewById(R.id.menu_bar);
final View statusContentView = view.findViewById(R.id.theme_preview_status_content);
final CardView cardView = (CardView) view.findViewById(R.id.card);
final int defaultTextSize = getDefaultTextSize(context);
final int cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
final int accentColor = ThemeUtils.getUserAccentColor(context);
final int themeId = ThemeUtils.getNoActionBarThemeResource(context);
final String backgroundOption = ThemeUtils.getThemeBackgroundOption(context);
ThemeUtils.applyWindowBackground(context, windowBackgroundView, themeId, backgroundOption,
ThemeUtils.getUserThemeBackgroundAlpha(context));
ViewSupport.setBackground(actionBarView, ThemeUtils.getActionBarBackground(context, themeRes,
accentColor, backgroundOption, true));
ViewCompat.setElevation(actionBarView, ThemeUtils.getSupportActionBarElevation(context));
ViewSupport.setBackground(actionBarOverlay, ThemeUtils.getWindowContentOverlay(context));
cardView.setCardBackgroundColor(cardBackgroundColor);
actionBarView.setTitle(R.string.app_name);
menuBar.setEnabled(false);
final MenuInflater inflater = new SupportMenuInflater(context);
inflater.inflate(R.menu.menu_status, menuBar.getMenu());
ThemeUtils.wrapMenuIcon(menuBar, MENU_GROUP_STATUS_SHARE);
if (statusContentView != null) {
final View profileView = statusContentView.findViewById(R.id.profile_container);
final ImageView profileImageView = (ImageView) statusContentView.findViewById(R.id.profile_image);
final TextView nameView = (TextView) statusContentView.findViewById(R.id.name);
final TextView screenNameView = (TextView) statusContentView.findViewById(R.id.screen_name);
final TextView textView = (TextView) statusContentView.findViewById(R.id.text);
final TextView timeSourceView = (TextView) statusContentView.findViewById(R.id.time_source);
final View retweetedByContainer = statusContentView.findViewById(R.id.retweeted_by_container);
retweetedByContainer.setVisibility(View.GONE);
nameView.setTextSize(defaultTextSize * 1.25f);
textView.setTextSize(defaultTextSize * 1.25f);
screenNameView.setTextSize(defaultTextSize * 0.85f);
timeSourceView.setTextSize(defaultTextSize * 0.85f);
profileView.setBackgroundResource(0);
textView.setTextIsSelectable(false);
profileImageView.setImageResource(R.mipmap.ic_launcher);
nameView.setText(TWIDERE_PREVIEW_NAME);
screenNameView.setText("@" + TWIDERE_PREVIEW_SCREEN_NAME);
textView.setText(toPlainText(TWIDERE_PREVIEW_TEXT_HTML));
final String time = formatToLongTimeString(context, System.currentTimeMillis());
timeSourceView.setText(toPlainText(context.getString(R.string.time_source, time, TWIDERE_PREVIEW_SOURCE)));
}
}
private static class DummyTouchInterceptor implements TouchInterceptor {
@Override
public boolean dispatchTouchEvent(final View view, final MotionEvent event) {
return false;
}
@Override
public boolean onInterceptTouchEvent(final View view, final MotionEvent event) {
return true;
}
@Override
public boolean onTouchEvent(final View view, final MotionEvent event) {
return false;
}
}
}

View File

@ -46,10 +46,18 @@ public class MathUtils {
} }
// Returns the previous power of two. // Returns the previous power of two.
// Returns the input if it is already power of 2. // Returns the input if it is already power of 2.
// Throws IllegalArgumentException if the input is <= 0 // Throws IllegalArgumentException if the input is <= 0
public static int prevPowerOf2(final int n) { public static int prevPowerOf2(final int n) {
if (n <= 0) throw new IllegalArgumentException(); if (n <= 0) throw new IllegalArgumentException();
return Integer.highestOneBit(n); return Integer.highestOneBit(n);
} }
public static double sum(double... doubles) {
double sum = 0;
for (double d : doubles) {
sum += d;
}
return sum;
}
} }

View File

@ -3823,7 +3823,7 @@ public final class Utils implements Constants {
final SpannableStringBuilder text = SpannableStringBuilder.valueOf(textView.getText()); final SpannableStringBuilder text = SpannableStringBuilder.valueOf(textView.getText());
final URLSpan[] spans = text.getSpans(0, text.length(), URLSpan.class); final URLSpan[] spans = text.getSpans(0, text.length(), URLSpan.class);
URLSpan found = null; URLSpan found = null;
String findPattern = "twitter.com/" + status.quoted_by_user_screen_name + "/status/" + status.quote_id; String findPattern = "twitter.com/" + status.user_screen_name + "/status/" + status.quote_id;
for (URLSpan span : spans) { for (URLSpan span : spans) {
if (span.getURL().contains(findPattern)) { if (span.getURL().contains(findPattern)) {
found = span; found = span;
@ -3920,4 +3920,17 @@ public final class Utils implements Constants {
return location; return location;
} }
public static final String[] fileSizeUnits = {"bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
public static String calculateProperSize(double bytes) {
double value = bytes;
int index;
for (index = 0; index < fileSizeUnits.length; index++) {
if (value < 1024) {
break;
}
value = value / 1024;
}
return String.format("%.2f %s", value, fileSizeUnits[index]);
}
} }

View File

@ -0,0 +1,40 @@
<?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/>.
-->
<RelativeLayout 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="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/total_usage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceLarge"
tools:text="124.50mb" />
<com.db.chart.view.StackBarChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="@+id/total_usage"
app:chart_barSpacing="2dp" />
</RelativeLayout>

View File

@ -1,39 +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="wrap_content">
<org.mariotaku.twidere.view.ExtendedRelativeLayout
android:id="@+id/theme_preview_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp">
<include layout="@layout/theme_preview_content"/>
</org.mariotaku.twidere.view.ExtendedRelativeLayout>
</FrameLayout>

View File

@ -1,68 +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/>.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<View
android:id="@+id/theme_preview_window_wallpaper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/theme_preview_window_content"
android:layout_alignTop="@+id/theme_preview_window_content"
android:background="@drawable/nyan_stars_background"/>
<View
android:id="@+id/theme_preview_window_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/theme_preview_window_content"
android:layout_alignTop="@+id/theme_preview_window_content"/>
<LinearLayout
android:id="@+id/theme_preview_window_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/action_bar"
style="?actionBarStyle"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:gravity="center_vertical"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/theme_preview_status_content"/>
<View
android:id="@+id/actionbar_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
</LinearLayout>
</merge>

View File

@ -1,46 +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 xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/theme_preview_status_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:ignore="UselessParent">
<include
android:id="@+id/status_content"
layout="@layout/header_status"/>
<View
android:id="@+id/theme_preview_window_content_overlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/status_content"
android:layout_alignTop="@+id/status_content"/>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,76 @@
<?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/>.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="false"
android:key="quick_send"
android:summary="@string/quick_send_summary"
android:title="@string/quick_send"/>
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="false"
android:key="no_close_after_tweet_sent"
android:summary="@string/no_close_after_status_updated_summary"
android:title="@string/no_close_after_status_updated"/>
<org.mariotaku.twidere.preference.ComposeNowPreference
android:key="compose_now"
android:summary="@string/compose_now_summary"
android:title="@string/compose_now"/>
<org.mariotaku.twidere.preference.SummaryListPreference
android:defaultValue="compose"
android:dependency="compose_now"
android:entries="@array/entries_compose_now_action"
android:entryValues="@array/values_compose_now_action"
android:key="compose_now_action"
android:title="@string/compose_now_action"/>
<EditTextPreference
android:defaultValue="[TEXT] [LINK]"
android:dialogTitle="@string/image_upload_format"
android:key="media_upload_format"
android:singleLine="true"
android:summary="@string/image_upload_format_summary"
android:title="@string/image_upload_format"/>
<org.mariotaku.twidere.preference.StatusShortenerPreference
android:defaultValue=""
android:key="status_shortener"
android:summary="%s"
android:title="@string/status_shortener"/>
<EditTextPreference
android:defaultValue="RT @[NAME]: [TEXT]"
android:dialogTitle="@string/quote_format"
android:key="quote_format"
android:singleLine="true"
android:summary="@string/quote_format_summary"
android:title="@string/quote_format"/>
<EditTextPreference
android:defaultValue="[TITLE] - [TEXT]"
android:dialogTitle="@string/share_format"
android:key="share_format"
android:singleLine="true"
android:summary="@string/share_format_summary"
android:title="@string/share_format"/>
</PreferenceScreen>

View File

@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:key="settings_content" android:key="settings_content"
android:title="@string/content_and_storage"> android:title="@string/content_and_storage">
<!--<org.mariotaku.twidere.preference.NetworkUsageSummaryPreferences-->
<!--android:key="network_usage_summary"/>-->
<PreferenceCategory <PreferenceCategory
android:key="category_multimedia_contents" android:key="category_multimedia_contents"
android:title="@string/multimedia_contents"> android:title="@string/multimedia_contents">
@ -12,49 +14,20 @@
android:defaultValue="" android:defaultValue=""
android:key="media_uploader" android:key="media_uploader"
android:summary="%s" android:summary="%s"
android:title="@string/image_uploader"/> android:title="@string/image_uploader" />
<EditTextPreference
android:defaultValue="[TEXT] [LINK]"
android:dialogTitle="@string/image_upload_format"
android:key="media_upload_format"
android:singleLine="true"
android:summary="@string/image_upload_format_summary"
android:title="@string/image_upload_format"/>
<org.mariotaku.twidere.preference.ImagePreloadPreference <org.mariotaku.twidere.preference.ImagePreloadPreference
android:key="image_preload_options" android:key="image_preload_options"
android:title="@string/image_preload_options"/> android:title="@string/image_preload_options" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="preload_wifi_only" android:key="preload_wifi_only"
android:title="@string/preload_wifi_only"/> android:title="@string/preload_wifi_only" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="category_content" android:key="category_content"
android:title="@string/content"> android:title="@string/content">
<org.mariotaku.twidere.preference.StatusShortenerPreference
android:defaultValue=""
android:key="status_shortener"
android:summary="%s"
android:title="@string/status_shortener"/>
<EditTextPreference
android:defaultValue="RT @[NAME]: [TEXT]"
android:dialogTitle="@string/quote_format"
android:key="quote_format"
android:singleLine="true"
android:summary="@string/quote_format_summary"
android:title="@string/quote_format"/>
<EditTextPreference
android:defaultValue="[TITLE] - [TEXT]"
android:dialogTitle="@string/share_format"
android:key="share_format"
android:singleLine="true"
android:summary="@string/share_format_summary"
android:title="@string/share_format"/>
<org.mariotaku.twidere.preference.SeekBarDialogPreference <org.mariotaku.twidere.preference.SeekBarDialogPreference
android:defaultValue="20" android:defaultValue="20"
@ -63,34 +36,41 @@
android:title="@string/load_item_limit" android:title="@string/load_item_limit"
app:max="200" app:max="200"
app:min="10" app:min="10"
app:step="5"/> app:step="5" />
<org.mariotaku.twidere.preference.TimelineSyncPreference <org.mariotaku.twidere.preference.TimelineSyncPreference
android:defaultValue="" android:defaultValue=""
android:key="timeline_sync_service" android:key="timeline_sync_service"
android:summary="%s" android:summary="%s"
android:title="@string/timeline_sync_service"/> android:title="@string/timeline_sync_service" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="remember_position" android:key="remember_position"
android:summary="@string/remember_position_summary" android:summary="@string/remember_position_summary"
android:title="@string/remember_position"/> android:title="@string/remember_position" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="read_from_bottom" android:key="read_from_bottom"
android:summaryOff="@string/read_from_bottom_summary_off" android:summaryOff="@string/read_from_bottom_summary_off"
android:summaryOn="@string/read_from_bottom_summary_on" android:summaryOn="@string/read_from_bottom_summary_on"
android:title="@string/read_from_bottom"/> android:title="@string/read_from_bottom" />
<org.mariotaku.twidere.preference.TrendsLocationPreference <org.mariotaku.twidere.preference.TrendsLocationPreference
android:key="trends_location" android:key="trends_location"
android:summary="@string/trends_location_summary" android:summary="@string/trends_location_summary"
android:title="@string/trends_location"/> android:title="@string/trends_location" />
<org.mariotaku.twidere.preference.TranslationDestinationPreference <org.mariotaku.twidere.preference.TranslationDestinationPreference
android:key="translation_destination" android:key="translation_destination"
android:title="@string/translation_destination"/> android:title="@string/translation_destination" />
<org.mariotaku.twidere.preference.ComponentStatePreference
android:name="org.mariotaku.twidere.activity.TwitterLinkHandlerActivity"
android:key="twitter_link_handler"
android:title="@string/open_twitter_links" />
<Preference
android:fragment="org.mariotaku.twidere.fragment.KeyboardShortcutsFragment"
android:title="@string/keyboard_shortcuts" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="category_safety" android:key="category_safety"
@ -99,12 +79,12 @@
android:defaultValue="true" android:defaultValue="true"
android:key="phishing_link_warning" android:key="phishing_link_warning"
android:summary="@string/phishing_link_warning_summary" android:summary="@string/phishing_link_warning_summary"
android:title="@string/phishing_link_warning"/> android:title="@string/phishing_link_warning" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="display_sensitive_contents" android:key="display_sensitive_contents"
android:summary="@string/display_sensitive_contents_summary" android:summary="@string/display_sensitive_contents_summary"
android:title="@string/display_sensitive_contents"/> android:title="@string/display_sensitive_contents" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/settings_interface">
<PreferenceCategory android:title="@string/font">
</PreferenceCategory>
</PreferenceScreen>

View File

@ -1,60 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/other_settings"> android:title="@string/other_settings">
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="false"
android:key="quick_send"
android:summary="@string/quick_send_summary"
android:title="@string/quick_send"/>
<org.mariotaku.twidere.preference.AutoFixCheckBoxPreference
android:defaultValue="false"
android:key="no_close_after_tweet_sent"
android:summary="@string/no_close_after_status_updated_summary"
android:title="@string/no_close_after_status_updated"/>
<org.mariotaku.twidere.preference.ComponentStatePreference
android:name="org.mariotaku.twidere.activity.TwitterLinkHandlerActivity"
android:key="twitter_link_handler"
android:title="@string/open_twitter_links"/>
<org.mariotaku.twidere.preference.ComposeNowPreference
android:key="compose_now"
android:summary="@string/compose_now_summary"
android:title="@string/compose_now"/>
<org.mariotaku.twidere.preference.SummaryListPreference
android:defaultValue="compose"
android:dependency="compose_now"
android:entries="@array/entries_compose_now_action"
android:entryValues="@array/values_compose_now_action"
android:key="compose_now_action"
android:title="@string/compose_now_action"/>
<Preference
android:fragment="org.mariotaku.twidere.fragment.KeyboardShortcutsFragment"
android:title="@string/keyboard_shortcuts"/>
<Preference <Preference
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:title="@string/usage_statistics"> android:title="@string/usage_statistics">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_usage_statistics"/> android:value="@xml/preferences_usage_statistics" />
</Preference> </Preference>
<org.mariotaku.twidere.preference.SettingsImportExportPreference <org.mariotaku.twidere.preference.SettingsImportExportPreference
android:key="import_export_settings" android:key="import_export_settings"
android:title="@string/import_export_settings"/> android:title="@string/import_export_settings" />
<Preference <Preference
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:title="@string/scrapyard"> android:title="@string/scrapyard">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_scrapyard"/> android:value="@xml/preferences_scrapyard" />
</Preference> </Preference>
</PreferenceScreen> </PreferenceScreen>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
<header android:title="@string/appearance"/> <header android:title="@string/appearance" />
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_color_palette" android:icon="@drawable/ic_action_color_palette"
android:title="@string/theme"> android:title="@string/theme">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_theme"/> android:value="@xml/preferences_theme" />
</header> </header>
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
@ -16,48 +16,24 @@
android:title="@string/cards"> android:title="@string/cards">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_cards"/> android:value="@xml/preferences_cards" />
</header> </header>
<header android:title="@string/function"/> <header android:title="@string/function" />
<header <header
android:fragment="org.mariotaku.twidere.fragment.CustomTabsFragment" android:fragment="org.mariotaku.twidere.fragment.CustomTabsFragment"
android:icon="@drawable/ic_action_tab" android:icon="@drawable/ic_action_tab"
android:title="@string/tabs"/> android:title="@string/tabs" />
<header <header
android:fragment="org.mariotaku.twidere.fragment.ExtensionsListFragment" android:fragment="org.mariotaku.twidere.fragment.ExtensionsListFragment"
android:icon="@drawable/ic_action_extension" android:icon="@drawable/ic_action_extension"
android:title="@string/extensions"/> android:title="@string/extensions" />
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_server"
android:title="@string/network">
<extra
android:name="resid"
android:value="@xml/preferences_network"/>
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_twidere_square"
android:title="@string/content">
<extra
android:name="resid"
android:value="@xml/preferences_content"/>
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_storage"
android:title="@string/storage">
<extra
android:name="resid"
android:value="@xml/preferences_storage"/>
</header>
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_refresh" android:icon="@drawable/ic_action_refresh"
android:title="@string/refresh"> android:title="@string/refresh">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_refresh"/> android:value="@xml/preferences_refresh" />
</header> </header>
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
@ -65,7 +41,39 @@
android:title="@string/notifications"> android:title="@string/notifications">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_notifications"/> android:value="@xml/preferences_notifications" />
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_status_compose"
android:title="@string/compose">
<extra
android:name="resid"
android:value="@xml/preferences_compose" />
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_twidere_square"
android:title="@string/content">
<extra
android:name="resid"
android:value="@xml/preferences_content" />
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_storage"
android:title="@string/storage">
<extra
android:name="resid"
android:value="@xml/preferences_storage" />
</header>
<header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_server"
android:title="@string/network">
<extra
android:name="resid"
android:value="@xml/preferences_network" />
</header> </header>
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
@ -73,16 +81,16 @@
android:title="@string/other_settings"> android:title="@string/other_settings">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_other"/> android:value="@xml/preferences_other" />
</header> </header>
<header android:title="@string/about"/> <header android:title="@string/about" />
<header <header
android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment" android:fragment="org.mariotaku.twidere.fragment.SettingsDetailsFragment"
android:icon="@drawable/ic_action_info" android:icon="@drawable/ic_action_info"
android:title="@string/about"> android:title="@string/about">
<extra <extra
android:name="resid" android:name="resid"
android:value="@xml/preferences_about"/> android:value="@xml/preferences_about" />
</header> </header>
<header <header
android:fragment="org.mariotaku.twidere.fragment.BrowserFragment" android:fragment="org.mariotaku.twidere.fragment.BrowserFragment"
@ -90,7 +98,7 @@
android:title="@string/open_source_license"> android:title="@string/open_source_license">
<extra <extra
android:name="uri" android:name="uri"
android:value="file:///android_asset/gpl-3.0-standalone.html"/> android:value="file:///android_asset/gpl-3.0-standalone.html" />
</header> </header>
</preference-headers> </preference-headers>