mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
RageShake impleme + Import stuff from Riot
This commit is contained in:
parent
79e273b1ca
commit
bc467340c9
67 changed files with 3946 additions and 22 deletions
|
@ -183,6 +183,9 @@ dependencies {
|
|||
// FP
|
||||
implementation "io.arrow-kt:arrow-core:$arrow_version"
|
||||
|
||||
// Pref
|
||||
implementation 'androidx.preference:preference:1.0.0'
|
||||
|
||||
// UI
|
||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha02'
|
||||
|
@ -190,6 +193,13 @@ dependencies {
|
|||
implementation "ru.noties.markwon:core:$markwon_version"
|
||||
implementation "ru.noties.markwon:html:$markwon_version"
|
||||
|
||||
// Butterknife
|
||||
implementation 'com.jakewharton:butterknife:10.1.0'
|
||||
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
|
||||
|
||||
// Shake detection
|
||||
implementation 'com.squareup:seismic:1.0.2'
|
||||
|
||||
// Image Loading
|
||||
implementation "com.github.piasy:BigImageViewer:$big_image_viewer_version"
|
||||
implementation "com.github.piasy:GlideImageLoader:$big_image_viewer_version"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Riot">
|
||||
android:theme="@style/AppTheme.Light">
|
||||
|
||||
<activity
|
||||
android:name=".features.MainActivity"
|
||||
|
@ -27,6 +27,7 @@
|
|||
<activity android:name=".features.home.HomeActivity" />
|
||||
<activity android:name=".features.login.LoginActivity" />
|
||||
<activity android:name=".features.media.MediaViewerActivity" />
|
||||
<activity android:name=".features.rageshake.BugReportActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.core.extensions
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
|
||||
fun Boolean.toOnOff() = if (this) "ON" else "OFF"
|
||||
|
||||
/**
|
||||
* Apply argument to a Fragment
|
||||
*/
|
||||
fun <T : Fragment> T.withArgs(block: Bundle.() -> Unit) = apply { arguments = Bundle().apply(block) }
|
|
@ -17,15 +17,41 @@
|
|||
package im.vector.riotredesign.core.platform
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.MainThread
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.annotation.*
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.Unbinder
|
||||
import com.airbnb.mvrx.BaseMvRxActivity
|
||||
import com.bumptech.glide.util.Util
|
||||
import im.vector.riotredesign.BuildConfig
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.features.rageshake.RageShake
|
||||
import im.vector.riotredesign.receivers.DebugReceiver
|
||||
import im.vector.ui.themes.ActivityOtherThemes
|
||||
import im.vector.ui.themes.ThemeUtils
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
|
||||
abstract class RiotActivity : BaseMvRxActivity() {
|
||||
/* ==========================================================================================
|
||||
* UI
|
||||
* ========================================================================================== */
|
||||
|
||||
@Nullable
|
||||
@BindView(R.id.toolbar)
|
||||
protected lateinit var toolbar: Toolbar
|
||||
|
||||
/* ==========================================================================================
|
||||
* DATA
|
||||
* ========================================================================================== */
|
||||
|
||||
private var unBinder: Unbinder? = null
|
||||
|
||||
private var savedInstanceState: Bundle? = null
|
||||
|
||||
// For debug only
|
||||
private var debugReceiver: DebugReceiver? = null
|
||||
|
@ -33,6 +59,8 @@ abstract class RiotActivity : BaseMvRxActivity() {
|
|||
private val uiDisposables = CompositeDisposable()
|
||||
private val restorables = ArrayList<Restorable>()
|
||||
|
||||
private var rageShake: RageShake? = null
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
restorables.forEach { it.onSaveInstanceState(outState) }
|
||||
|
@ -55,9 +83,41 @@ abstract class RiotActivity : BaseMvRxActivity() {
|
|||
return this
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Shake detector
|
||||
rageShake = RageShake(this)
|
||||
|
||||
ThemeUtils.setActivityTheme(this, getOtherThemes())
|
||||
|
||||
doBeforeSetContentView()
|
||||
|
||||
if (getLayoutRes() != -1) {
|
||||
setContentView(getLayoutRes())
|
||||
}
|
||||
|
||||
unBinder = ButterKnife.bind(this)
|
||||
|
||||
this.savedInstanceState = savedInstanceState
|
||||
|
||||
initUiAndData()
|
||||
|
||||
val titleRes = getTitleRes()
|
||||
if (titleRes != -1) {
|
||||
supportActionBar?.let {
|
||||
it.setTitle(titleRes)
|
||||
} ?: run {
|
||||
setTitle(titleRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
rageShake?.start()
|
||||
|
||||
DebugReceiver
|
||||
.getIntentFilter(this)
|
||||
.takeIf { BuildConfig.DEBUG }
|
||||
|
@ -70,10 +130,97 @@ abstract class RiotActivity : BaseMvRxActivity() {
|
|||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
||||
rageShake?.stop()
|
||||
|
||||
debugReceiver?.let {
|
||||
unregisterReceiver(debugReceiver)
|
||||
debugReceiver = null
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* MENU MANAGEMENT
|
||||
* ========================================================================================== */
|
||||
|
||||
final override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val menuRes = getMenuRes()
|
||||
|
||||
if (menuRes != -1) {
|
||||
menuInflater.inflate(menuRes, menu)
|
||||
ThemeUtils.tintMenuIcons(menu, ThemeUtils.getColor(this, getMenuTint()))
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* PROTECTED METHODS
|
||||
* ========================================================================================== */
|
||||
|
||||
/**
|
||||
* Get the saved instance state.
|
||||
* Ensure {@link isFirstCreation()} returns false before calling this
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected fun getSavedInstanceState(): Bundle {
|
||||
return savedInstanceState!!
|
||||
}
|
||||
|
||||
/**
|
||||
* Is first creation
|
||||
*
|
||||
* @return true if Activity is created for the first time (and not restored by the system)
|
||||
*/
|
||||
protected fun isFirstCreation() = savedInstanceState == null
|
||||
|
||||
/**
|
||||
* Configure the Toolbar. It MUST be present in your layout with id "toolbar"
|
||||
*/
|
||||
protected fun configureToolbar() {
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
supportActionBar?.let {
|
||||
it.setDisplayShowHomeEnabled(true)
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* OPEN METHODS
|
||||
* ========================================================================================== */
|
||||
|
||||
@LayoutRes
|
||||
open fun getLayoutRes() = -1
|
||||
|
||||
open fun displayInFullscreen() = false
|
||||
|
||||
open fun doBeforeSetContentView() = Unit
|
||||
|
||||
open fun initUiAndData() = Unit
|
||||
|
||||
@StringRes
|
||||
open fun getTitleRes() = -1
|
||||
|
||||
@MenuRes
|
||||
open fun getMenuRes() = -1
|
||||
|
||||
@AttrRes
|
||||
open fun getMenuTint() = 0 // TODO R.attr.vctr_icon_tint_on_dark_action_bar_color
|
||||
|
||||
/**
|
||||
* Return a object containing other themes for this activity
|
||||
*/
|
||||
open fun getOtherThemes(): ActivityOtherThemes = ActivityOtherThemes.Default
|
||||
}
|
|
@ -21,7 +21,6 @@ package im.vector.riotredesign.features.media
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import com.github.piasy.biv.indicator.progresspie.ProgressPieIndicator
|
||||
import com.github.piasy.biv.view.GlideImageViewFactory
|
||||
|
@ -54,17 +53,6 @@ class MediaViewerActivity : RiotActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
finish()
|
||||
return true
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
private const val EXTRA_MEDIA_DATA = "EXTRA_MEDIA_DATA"
|
||||
|
|
209
app/src/main/java/im/vector/riotredesign/features/rageshake/BugReportActivity.kt
Executable file
209
app/src/main/java/im/vector/riotredesign/features/rageshake/BugReportActivity.kt
Executable file
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.features.rageshake
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.BindView
|
||||
import butterknife.OnCheckedChanged
|
||||
import butterknife.OnTextChanged
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.platform.RiotActivity
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Form to send a bug report
|
||||
*/
|
||||
class BugReportActivity : RiotActivity() {
|
||||
|
||||
/* ==========================================================================================
|
||||
* UI
|
||||
* ========================================================================================== */
|
||||
|
||||
@BindView(R.id.bug_report_edit_text)
|
||||
lateinit var mBugReportText: EditText
|
||||
|
||||
@BindView(R.id.bug_report_button_include_logs)
|
||||
lateinit var mIncludeLogsButton: CheckBox
|
||||
|
||||
@BindView(R.id.bug_report_button_include_crash_logs)
|
||||
lateinit var mIncludeCrashLogsButton: CheckBox
|
||||
|
||||
@BindView(R.id.bug_report_button_include_screenshot)
|
||||
lateinit var mIncludeScreenShotButton: CheckBox
|
||||
|
||||
@BindView(R.id.bug_report_screenshot_preview)
|
||||
lateinit var mScreenShotPreview: ImageView
|
||||
|
||||
@BindView(R.id.bug_report_progress_view)
|
||||
lateinit var mProgressBar: ProgressBar
|
||||
|
||||
@BindView(R.id.bug_report_progress_text_view)
|
||||
lateinit var mProgressTextView: TextView
|
||||
|
||||
@BindView(R.id.bug_report_scrollview)
|
||||
lateinit var mScrollView: View
|
||||
|
||||
@BindView(R.id.bug_report_mask_view)
|
||||
lateinit var mMaskView: View
|
||||
|
||||
override fun getLayoutRes() = R.layout.activity_bug_report
|
||||
|
||||
override fun initUiAndData() {
|
||||
configureToolbar()
|
||||
|
||||
if (BugReporter.getScreenshot() != null) {
|
||||
mScreenShotPreview.setImageBitmap(BugReporter.getScreenshot())
|
||||
} else {
|
||||
mScreenShotPreview.isVisible = false
|
||||
mIncludeScreenShotButton.isChecked = false
|
||||
mIncludeScreenShotButton.isEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMenuRes() = R.menu.bug_report
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
menu.findItem(R.id.ic_action_send_bug_report)?.let {
|
||||
val isValid = mBugReportText.text.toString().trim().length > 10
|
||||
&& !mMaskView.isVisible
|
||||
|
||||
it.isEnabled = isValid
|
||||
it.icon.alpha = if (isValid) 255 else 100
|
||||
}
|
||||
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.ic_action_send_bug_report -> {
|
||||
sendBugReport()
|
||||
return true
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send the bug report
|
||||
*/
|
||||
private fun sendBugReport() {
|
||||
mScrollView.alpha = 0.3f
|
||||
mMaskView.isVisible = true
|
||||
|
||||
invalidateOptionsMenu()
|
||||
|
||||
mProgressTextView.isVisible = true
|
||||
mProgressTextView.text = getString(R.string.send_bug_report_progress, 0.toString() + "")
|
||||
|
||||
mProgressBar.isVisible = true
|
||||
mProgressBar.progress = 0
|
||||
|
||||
BugReporter.sendBugReport(this,
|
||||
mIncludeLogsButton.isChecked,
|
||||
mIncludeCrashLogsButton.isChecked,
|
||||
mIncludeScreenShotButton.isChecked,
|
||||
mBugReportText.text.toString(),
|
||||
object : BugReporter.IMXBugReportListener {
|
||||
override fun onUploadFailed(reason: String?) {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(reason)) {
|
||||
Toast.makeText(this@BugReportActivity,
|
||||
getString(R.string.send_bug_report_failed, reason), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadFailed() : failed to display the toast " + e.message)
|
||||
}
|
||||
|
||||
mMaskView.isVisible = false
|
||||
mProgressBar.isVisible = false
|
||||
mProgressTextView.isVisible = false
|
||||
mScrollView.alpha = 1.0f
|
||||
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
override fun onUploadCancelled() {
|
||||
onUploadFailed(null)
|
||||
}
|
||||
|
||||
override fun onProgress(progress: Int) {
|
||||
var progress = progress
|
||||
if (progress > 100) {
|
||||
Timber.e("## onProgress() : progress > 100")
|
||||
progress = 100
|
||||
} else if (progress < 0) {
|
||||
Timber.e("## onProgress() : progress < 0")
|
||||
progress = 0
|
||||
}
|
||||
|
||||
mProgressBar.progress = progress
|
||||
mProgressTextView.text = getString(R.string.send_bug_report_progress, progress.toString() + "")
|
||||
}
|
||||
|
||||
override fun onUploadSucceed() {
|
||||
try {
|
||||
Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the toast " + e.message)
|
||||
}
|
||||
|
||||
try {
|
||||
finish()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the dialog " + e.message)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* UI Event
|
||||
* ========================================================================================== */
|
||||
|
||||
@OnTextChanged(R.id.bug_report_edit_text)
|
||||
internal fun textChanged() {
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
@OnCheckedChanged(R.id.bug_report_button_include_screenshot)
|
||||
internal fun onSendScreenshotChanged() {
|
||||
mScreenShotPreview.isVisible = mIncludeScreenShotButton.isChecked && BugReporter.getScreenshot() != null
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
// Ensure there is no crash status remaining, which will be sent later on by mistake
|
||||
BugReporter.deleteCrashFile(this)
|
||||
|
||||
super.onBackPressed()
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
* Companion
|
||||
* ========================================================================================== */
|
||||
|
||||
companion object {
|
||||
private val LOG_TAG = BugReportActivity::class.java.simpleName
|
||||
}
|
||||
}
|
728
app/src/main/java/im/vector/riotredesign/features/rageshake/BugReporter.java
Executable file
728
app/src/main/java/im/vector/riotredesign/features/rageshake/BugReporter.java
Executable file
|
@ -0,0 +1,728 @@
|
|||
/*
|
||||
* Copyright 2016 OpenMarket Ltd
|
||||
* Copyright 2017 Vector Creations Ltd
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.features.rageshake;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import im.vector.riotredesign.BuildConfig;
|
||||
import im.vector.riotredesign.R;
|
||||
import im.vector.riotredesign.core.extensions.BasicExtensionsKt;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import timber.log.Timber;
|
||||
|
||||
/**
|
||||
* BugReporter creates and sends the bug reports.
|
||||
*/
|
||||
public class BugReporter {
|
||||
private static final String LOG_TAG = BugReporter.class.getSimpleName();
|
||||
|
||||
private static boolean sInMultiWindowMode;
|
||||
|
||||
public static void setMultiWindowMode(boolean inMultiWindowMode) {
|
||||
sInMultiWindowMode = inMultiWindowMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug report upload listener
|
||||
*/
|
||||
public interface IMXBugReportListener {
|
||||
/**
|
||||
* The bug report has been cancelled
|
||||
*/
|
||||
void onUploadCancelled();
|
||||
|
||||
/**
|
||||
* The bug report upload failed.
|
||||
*
|
||||
* @param reason the failure reason
|
||||
*/
|
||||
void onUploadFailed(String reason);
|
||||
|
||||
/**
|
||||
* The upload progress (in percent)
|
||||
*
|
||||
* @param progress the upload progress
|
||||
*/
|
||||
void onProgress(int progress);
|
||||
|
||||
/**
|
||||
* The bug report upload succeeded.
|
||||
*/
|
||||
void onUploadSucceed();
|
||||
}
|
||||
|
||||
// filenames
|
||||
private static final String LOG_CAT_ERROR_FILENAME = "logcatError.log";
|
||||
private static final String LOG_CAT_FILENAME = "logcat.log";
|
||||
private static final String LOG_CAT_SCREENSHOT_FILENAME = "screenshot.png";
|
||||
private static final String CRASH_FILENAME = "crash.log";
|
||||
|
||||
|
||||
// the http client
|
||||
private static final OkHttpClient mOkHttpClient = new OkHttpClient();
|
||||
|
||||
// the pending bug report call
|
||||
private static Call mBugReportCall = null;
|
||||
|
||||
|
||||
// boolean to cancel the bug report
|
||||
private static boolean mIsCancelled = false;
|
||||
|
||||
/**
|
||||
* Send a bug report.
|
||||
*
|
||||
* @param context the application context
|
||||
* @param withDevicesLogs true to include the device log
|
||||
* @param withCrashLogs true to include the crash logs
|
||||
* @param withScreenshot true to include the screenshot
|
||||
* @param theBugDescription the bug description
|
||||
* @param listener the listener
|
||||
*/
|
||||
public static void sendBugReport(final Context context,
|
||||
final boolean withDevicesLogs,
|
||||
final boolean withCrashLogs,
|
||||
final boolean withScreenshot,
|
||||
final String theBugDescription,
|
||||
final IMXBugReportListener listener) {
|
||||
new AsyncTask<Void, Integer, String>() {
|
||||
|
||||
// enumerate files to delete
|
||||
final List<File> mBugReportFiles = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... voids) {
|
||||
String bugDescription = theBugDescription;
|
||||
String serverError = null;
|
||||
String crashCallStack = getCrashDescription(context);
|
||||
|
||||
if (null != crashCallStack) {
|
||||
bugDescription += "\n\n\n\n--------------------------------- crash call stack ---------------------------------\n";
|
||||
bugDescription += crashCallStack;
|
||||
}
|
||||
|
||||
List<File> gzippedFiles = new ArrayList<>();
|
||||
|
||||
if (withDevicesLogs) {
|
||||
// TODO Timber
|
||||
/*
|
||||
List<File> files = org.matrix.androidsdk.util.Timber.addLogFiles(new ArrayList<File>());
|
||||
|
||||
for (File f : files) {
|
||||
if (!mIsCancelled) {
|
||||
File gzippedFile = compressFile(f);
|
||||
|
||||
if (null != gzippedFile) {
|
||||
gzippedFiles.add(gzippedFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (!mIsCancelled && (withCrashLogs || withDevicesLogs)) {
|
||||
File gzippedLogcat = saveLogCat(context, false);
|
||||
|
||||
if (null != gzippedLogcat) {
|
||||
if (gzippedFiles.size() == 0) {
|
||||
gzippedFiles.add(gzippedLogcat);
|
||||
} else {
|
||||
gzippedFiles.add(0, gzippedLogcat);
|
||||
}
|
||||
}
|
||||
|
||||
File crashDescription = getCrashFile(context);
|
||||
if (crashDescription.exists()) {
|
||||
File compressedCrashDescription = compressFile(crashDescription);
|
||||
|
||||
if (null != compressedCrashDescription) {
|
||||
if (gzippedFiles.size() == 0) {
|
||||
gzippedFiles.add(compressedCrashDescription);
|
||||
} else {
|
||||
gzippedFiles.add(0, compressedCrashDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO MXSession session = Matrix.getInstance(context).getDefaultSession();
|
||||
|
||||
String deviceId = "undefined";
|
||||
String userId = "undefined";
|
||||
String matrixSdkVersion = "undefined";
|
||||
String olmVersion = "undefined";
|
||||
|
||||
/*
|
||||
TODO
|
||||
if (null != session) {
|
||||
userId = session.getMyUserId();
|
||||
deviceId = session.getCredentials().deviceId;
|
||||
matrixSdkVersion = session.getVersion(true);
|
||||
olmVersion = session.getCryptoVersion(context, true);
|
||||
}
|
||||
*/
|
||||
|
||||
if (!mIsCancelled) {
|
||||
// build the multi part request
|
||||
BugReporterMultipartBody.Builder builder = new BugReporterMultipartBody.Builder()
|
||||
.addFormDataPart("text", "[RiotX] " + bugDescription)
|
||||
.addFormDataPart("app", "riot-android")
|
||||
// TODO .addFormDataPart("user_agent", RestClient.getUserAgent())
|
||||
.addFormDataPart("user_id", userId)
|
||||
.addFormDataPart("device_id", deviceId)
|
||||
// TODO .addFormDataPart("version", Matrix.getInstance(context).getVersion(true, false))
|
||||
.addFormDataPart("branch_name", context.getString(R.string.git_branch_name))
|
||||
.addFormDataPart("matrix_sdk_version", matrixSdkVersion)
|
||||
.addFormDataPart("olm_version", olmVersion)
|
||||
.addFormDataPart("device", Build.MODEL.trim())
|
||||
.addFormDataPart("lazy_loading", BasicExtensionsKt.toOnOff(true))
|
||||
.addFormDataPart("multi_window", BasicExtensionsKt.toOnOff(sInMultiWindowMode))
|
||||
.addFormDataPart("os", Build.VERSION.RELEASE + " (API " + Build.VERSION.SDK_INT + ") "
|
||||
+ Build.VERSION.INCREMENTAL + "-" + Build.VERSION.CODENAME)
|
||||
.addFormDataPart("locale", Locale.getDefault().toString())
|
||||
// TODO .addFormDataPart("app_language", VectorLocale.INSTANCE.getApplicationLocale().toString())
|
||||
// TODO .addFormDataPart("default_app_language", SystemUtilsKt.getDeviceLocale(context).toString())
|
||||
// TODO .addFormDataPart("theme", ThemeUtils.INSTANCE.getApplicationTheme(context))
|
||||
;
|
||||
|
||||
String buildNumber = context.getString(R.string.build_number);
|
||||
if (!TextUtils.isEmpty(buildNumber) && !buildNumber.equals("0")) {
|
||||
builder.addFormDataPart("build_number", buildNumber);
|
||||
}
|
||||
|
||||
// add the gzipped files
|
||||
for (File file : gzippedFiles) {
|
||||
builder.addFormDataPart("compressed-log", file.getName(), RequestBody.create(MediaType.parse("application/octet-stream"), file));
|
||||
}
|
||||
|
||||
mBugReportFiles.addAll(gzippedFiles);
|
||||
|
||||
if (withScreenshot) {
|
||||
Bitmap bitmap = mScreenshot;
|
||||
|
||||
if (null != bitmap) {
|
||||
File logCatScreenshotFile = new File(context.getCacheDir().getAbsolutePath(), LOG_CAT_SCREENSHOT_FILENAME);
|
||||
|
||||
if (logCatScreenshotFile.exists()) {
|
||||
logCatScreenshotFile.delete();
|
||||
}
|
||||
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(logCatScreenshotFile);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
|
||||
builder.addFormDataPart("file",
|
||||
logCatScreenshotFile.getName(), RequestBody.create(MediaType.parse("application/octet-stream"), logCatScreenshotFile));
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## sendBugReport() : fail to write screenshot" + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mScreenshot = null;
|
||||
|
||||
// add some github labels
|
||||
builder.addFormDataPart("label", BuildConfig.VERSION_NAME);
|
||||
builder.addFormDataPart("label", BuildConfig.FLAVOR_DESCRIPTION);
|
||||
builder.addFormDataPart("label", context.getString(R.string.git_branch_name));
|
||||
|
||||
// Special for RiotX
|
||||
builder.addFormDataPart("label", "[RiotX]");
|
||||
|
||||
if (getCrashFile(context).exists()) {
|
||||
builder.addFormDataPart("label", "crash");
|
||||
deleteCrashFile(context);
|
||||
}
|
||||
|
||||
BugReporterMultipartBody requestBody = builder.build();
|
||||
|
||||
// add a progress listener
|
||||
requestBody.setWriteListener(new BugReporterMultipartBody.WriteListener() {
|
||||
@Override
|
||||
public void onWrite(long totalWritten, long contentLength) {
|
||||
int percentage;
|
||||
|
||||
if (-1 != contentLength) {
|
||||
if (totalWritten > contentLength) {
|
||||
percentage = 100;
|
||||
} else {
|
||||
percentage = (int) (totalWritten * 100 / contentLength);
|
||||
}
|
||||
} else {
|
||||
percentage = 0;
|
||||
}
|
||||
|
||||
if (mIsCancelled && (null != mBugReportCall)) {
|
||||
mBugReportCall.cancel();
|
||||
}
|
||||
|
||||
Timber.d("## onWrite() : " + percentage + "%");
|
||||
publishProgress(percentage);
|
||||
}
|
||||
});
|
||||
|
||||
// build the request
|
||||
Request request = new Request.Builder()
|
||||
.url(context.getString(R.string.bug_report_url))
|
||||
.post(requestBody)
|
||||
.build();
|
||||
|
||||
int responseCode = HttpURLConnection.HTTP_INTERNAL_ERROR;
|
||||
Response response = null;
|
||||
String errorMessage = null;
|
||||
|
||||
// trigger the request
|
||||
try {
|
||||
mBugReportCall = mOkHttpClient.newCall(request);
|
||||
response = mBugReportCall.execute();
|
||||
responseCode = response.code();
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "response " + e.getMessage());
|
||||
errorMessage = e.getLocalizedMessage();
|
||||
}
|
||||
|
||||
// if the upload failed, try to retrieve the reason
|
||||
if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||
if (null != errorMessage) {
|
||||
serverError = "Failed with error " + errorMessage;
|
||||
} else if ((null == response) || (null == response.body())) {
|
||||
serverError = "Failed with error " + responseCode;
|
||||
} else {
|
||||
InputStream is = null;
|
||||
|
||||
try {
|
||||
is = response.body().byteStream();
|
||||
|
||||
if (null != is) {
|
||||
int ch;
|
||||
StringBuilder b = new StringBuilder();
|
||||
while ((ch = is.read()) != -1) {
|
||||
b.append((char) ch);
|
||||
}
|
||||
serverError = b.toString();
|
||||
is.close();
|
||||
|
||||
// check if the error message
|
||||
try {
|
||||
JSONObject responseJSON = new JSONObject(serverError);
|
||||
serverError = responseJSON.getString("error");
|
||||
} catch (JSONException e) {
|
||||
Timber.e(e, "doInBackground ; Json conversion failed " + e.getMessage());
|
||||
}
|
||||
|
||||
// should never happen
|
||||
if (null == serverError) {
|
||||
serverError = "Failed with error " + responseCode;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## sendBugReport() : failed to parse error " + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (null != is) {
|
||||
is.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## sendBugReport() : failed to close the error stream " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return serverError;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(Integer... progress) {
|
||||
super.onProgressUpdate(progress);
|
||||
|
||||
if (null != listener) {
|
||||
try {
|
||||
listener.onProgress((null == progress) ? 0 : progress[0]);
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## onProgress() : failed " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String reason) {
|
||||
mBugReportCall = null;
|
||||
|
||||
// delete when the bug report has been successfully sent
|
||||
for (File file : mBugReportFiles) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
if (null != listener) {
|
||||
try {
|
||||
if (mIsCancelled) {
|
||||
listener.onUploadCancelled();
|
||||
} else if (null == reason) {
|
||||
listener.onUploadSucceed();
|
||||
} else {
|
||||
listener.onUploadFailed(reason);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## onPostExecute() : failed " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private static Bitmap mScreenshot = null;
|
||||
|
||||
/**
|
||||
* Get current Screenshot
|
||||
*
|
||||
* @return screenshot or null if not available
|
||||
*/
|
||||
@Nullable
|
||||
public static Bitmap getScreenshot() {
|
||||
return mScreenshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a bug report either with email or with Vector.
|
||||
*/
|
||||
public static void sendBugReport(Activity activity) {
|
||||
mScreenshot = takeScreenshot(activity);
|
||||
|
||||
Intent intent = new Intent(activity, BugReportActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
//==============================================================================================================
|
||||
// crash report management
|
||||
//==============================================================================================================
|
||||
|
||||
/**
|
||||
* Provides the crash file
|
||||
*
|
||||
* @param context the context
|
||||
* @return the crash file
|
||||
*/
|
||||
private static File getCrashFile(Context context) {
|
||||
return new File(context.getCacheDir().getAbsolutePath(), CRASH_FILENAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the crash file
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void deleteCrashFile(Context context) {
|
||||
File crashFile = getCrashFile(context);
|
||||
|
||||
if (crashFile.exists()) {
|
||||
crashFile.delete();
|
||||
}
|
||||
|
||||
// Also reset the screenshot
|
||||
mScreenshot = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the crash report
|
||||
*
|
||||
* @param context the context
|
||||
* @param crashDescription teh crash description
|
||||
*/
|
||||
public static void saveCrashReport(Context context, String crashDescription) {
|
||||
File crashFile = getCrashFile(context);
|
||||
|
||||
if (crashFile.exists()) {
|
||||
crashFile.delete();
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(crashDescription)) {
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(crashFile);
|
||||
OutputStreamWriter osw = new OutputStreamWriter(fos);
|
||||
osw.write(crashDescription);
|
||||
osw.close();
|
||||
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## saveCrashReport() : fail to write " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the crash description file and return its content.
|
||||
*
|
||||
* @param context teh context
|
||||
* @return the crash description
|
||||
*/
|
||||
private static String getCrashDescription(Context context) {
|
||||
String crashDescription = null;
|
||||
File crashFile = getCrashFile(context);
|
||||
|
||||
if (crashFile.exists()) {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(crashFile);
|
||||
InputStreamReader isr = new InputStreamReader(fis);
|
||||
|
||||
char[] buffer = new char[fis.available()];
|
||||
int len = isr.read(buffer, 0, fis.available());
|
||||
crashDescription = String.valueOf(buffer, 0, len);
|
||||
isr.close();
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## getCrashDescription() : fail to read " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return crashDescription;
|
||||
}
|
||||
|
||||
//==============================================================================================================
|
||||
// Screenshot management
|
||||
//==============================================================================================================
|
||||
|
||||
/**
|
||||
* Take a screenshot of the display.
|
||||
*
|
||||
* @return the screenshot
|
||||
*/
|
||||
private static Bitmap takeScreenshot(Activity activity) {
|
||||
// get content view
|
||||
View contentView = activity.findViewById(android.R.id.content);
|
||||
if (contentView == null) {
|
||||
Timber.e("Cannot find content view on " + activity + ". Cannot take screenshot.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// get the root view to snapshot
|
||||
View rootView = contentView.getRootView();
|
||||
if (rootView == null) {
|
||||
Timber.e("Cannot find root view on " + activity + ". Cannot take screenshot.");
|
||||
return null;
|
||||
}
|
||||
// refresh it
|
||||
rootView.setDrawingCacheEnabled(false);
|
||||
rootView.setDrawingCacheEnabled(true);
|
||||
|
||||
try {
|
||||
Bitmap bitmap = rootView.getDrawingCache();
|
||||
|
||||
// Make a copy, because if Activity is destroyed, the bitmap will be recycled
|
||||
bitmap = Bitmap.createBitmap(bitmap);
|
||||
|
||||
return bitmap;
|
||||
} catch (OutOfMemoryError oom) {
|
||||
Timber.e(oom, "Cannot get drawing cache for " + activity + " OOM.");
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "Cannot get snapshot of screen: " + e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//==============================================================================================================
|
||||
// Logcat management
|
||||
//==============================================================================================================
|
||||
|
||||
/**
|
||||
* Save the logcat
|
||||
*
|
||||
* @param context the context
|
||||
* @param isErrorLogcat true to save the error logcat
|
||||
* @return the file if the operation succeeds
|
||||
*/
|
||||
private static File saveLogCat(Context context, boolean isErrorLogcat) {
|
||||
File logCatErrFile = new File(context.getCacheDir().getAbsolutePath(), isErrorLogcat ? LOG_CAT_ERROR_FILENAME : LOG_CAT_FILENAME);
|
||||
|
||||
if (logCatErrFile.exists()) {
|
||||
logCatErrFile.delete();
|
||||
}
|
||||
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(logCatErrFile);
|
||||
OutputStreamWriter osw = new OutputStreamWriter(fos);
|
||||
getLogCatError(osw, isErrorLogcat);
|
||||
osw.close();
|
||||
|
||||
fos.flush();
|
||||
fos.close();
|
||||
|
||||
return compressFile(logCatErrFile);
|
||||
} catch (OutOfMemoryError error) {
|
||||
Timber.e(error, "## saveLogCat() : fail to write logcat" + error.toString());
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## saveLogCat() : fail to write logcat" + e.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final int BUFFER_SIZE = 1024 * 1024 * 50;
|
||||
|
||||
private static final String[] LOGCAT_CMD_ERROR = new String[]{
|
||||
"logcat", ///< Run 'logcat' command
|
||||
"-d", ///< Dump the log rather than continue outputting it
|
||||
"-v", // formatting
|
||||
"threadtime", // include timestamps
|
||||
"AndroidRuntime:E " + ///< Pick all AndroidRuntime errors (such as uncaught exceptions)"communicatorjni:V " + ///< All communicatorjni logging
|
||||
"libcommunicator:V " + ///< All libcommunicator logging
|
||||
"DEBUG:V " + ///< All DEBUG logging - which includes native land crashes (seg faults, etc)
|
||||
"*:S" ///< Everything else silent, so don't pick it..
|
||||
};
|
||||
|
||||
private static final String[] LOGCAT_CMD_DEBUG = new String[]{
|
||||
"logcat",
|
||||
"-d",
|
||||
"-v",
|
||||
"threadtime",
|
||||
"*:*"
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the logs
|
||||
*
|
||||
* @param streamWriter the stream writer
|
||||
* @param isErrorLogCat true to save the error logs
|
||||
*/
|
||||
private static void getLogCatError(OutputStreamWriter streamWriter, boolean isErrorLogCat) {
|
||||
Process logcatProc;
|
||||
|
||||
try {
|
||||
logcatProc = Runtime.getRuntime().exec(isErrorLogCat ? LOGCAT_CMD_ERROR : LOGCAT_CMD_DEBUG);
|
||||
} catch (IOException e1) {
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
String separator = System.getProperty("line.separator");
|
||||
reader = new BufferedReader(new InputStreamReader(logcatProc.getInputStream()), BUFFER_SIZE);
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
streamWriter.append(line);
|
||||
streamWriter.append(separator);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Timber.e(e, "getLog fails with " + e.getLocalizedMessage());
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
Timber.e(e, "getLog fails with " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================================================
|
||||
// File compression management
|
||||
//==============================================================================================================
|
||||
|
||||
/**
|
||||
* GZip a file
|
||||
*
|
||||
* @param fin the input file
|
||||
* @return the gzipped file
|
||||
*/
|
||||
private static File compressFile(File fin) {
|
||||
Timber.d("## compressFile() : compress " + fin.getName());
|
||||
|
||||
File dstFile = new File(fin.getParent(), fin.getName() + ".gz");
|
||||
|
||||
if (dstFile.exists()) {
|
||||
dstFile.delete();
|
||||
}
|
||||
|
||||
FileOutputStream fos = null;
|
||||
GZIPOutputStream gos = null;
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
fos = new FileOutputStream(dstFile);
|
||||
gos = new GZIPOutputStream(fos);
|
||||
|
||||
inputStream = new FileInputStream(fin);
|
||||
int n;
|
||||
|
||||
byte[] buffer = new byte[2048];
|
||||
while ((n = inputStream.read(buffer)) != -1) {
|
||||
gos.write(buffer, 0, n);
|
||||
}
|
||||
|
||||
gos.close();
|
||||
inputStream.close();
|
||||
|
||||
Timber.d("## compressFile() : " + fin.length() + " compressed to " + dstFile.length() + " bytes");
|
||||
return dstFile;
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## compressFile() failed " + e.getMessage());
|
||||
} catch (OutOfMemoryError oom) {
|
||||
Timber.e(oom, "## compressFile() failed " + oom.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (null != fos) {
|
||||
fos.close();
|
||||
}
|
||||
if (null != gos) {
|
||||
gos.close();
|
||||
}
|
||||
if (null != inputStream) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "## compressFile() failed to close inputStream " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
* Copyright 2017 Vector Creations Ltd
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.features.rageshake;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.internal.Util;
|
||||
import okio.Buffer;
|
||||
import okio.BufferedSink;
|
||||
import okio.ByteString;
|
||||
|
||||
// simplified version of MultipartBody (OkHttp 3.6.0)
|
||||
public class BugReporterMultipartBody extends RequestBody {
|
||||
|
||||
/**
|
||||
* Listener
|
||||
*/
|
||||
public interface WriteListener {
|
||||
/**
|
||||
* Upload listener
|
||||
*
|
||||
* @param totalWritten total written bytes
|
||||
* @param contentLength content length
|
||||
*/
|
||||
void onWrite(long totalWritten, long contentLength);
|
||||
}
|
||||
|
||||
private static final MediaType FORM = MediaType.parse("multipart/form-data");
|
||||
|
||||
private static final byte[] COLONSPACE = {':', ' '};
|
||||
private static final byte[] CRLF = {'\r', '\n'};
|
||||
private static final byte[] DASHDASH = {'-', '-'};
|
||||
|
||||
private final ByteString mBoundary;
|
||||
private final MediaType mContentType;
|
||||
private final List<Part> mParts;
|
||||
private long mContentLength = -1L;
|
||||
|
||||
// listener
|
||||
private WriteListener mWriteListener;
|
||||
|
||||
//
|
||||
private List<Long> mContentLengthSize = null;
|
||||
|
||||
private BugReporterMultipartBody(ByteString boundary, List<Part> parts) {
|
||||
mBoundary = boundary;
|
||||
mContentType = MediaType.parse(FORM + "; boundary=" + boundary.utf8());
|
||||
mParts = Util.immutableList(parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaType contentType() {
|
||||
return mContentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long contentLength() throws IOException {
|
||||
long result = mContentLength;
|
||||
if (result != -1L) return result;
|
||||
return mContentLength = writeOrCountBytes(null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(BufferedSink sink) throws IOException {
|
||||
writeOrCountBytes(sink, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the listener
|
||||
*
|
||||
* @param listener the
|
||||
*/
|
||||
public void setWriteListener(WriteListener listener) {
|
||||
mWriteListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn the listener that some bytes have been written
|
||||
*
|
||||
* @param totalWrittenBytes the total written bytes
|
||||
*/
|
||||
private void onWrite(long totalWrittenBytes) {
|
||||
if ((null != mWriteListener) && (mContentLength > 0)) {
|
||||
mWriteListener.onWrite(totalWrittenBytes, mContentLength);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Either writes this request to {@code sink} or measures its content length. We have one method
|
||||
* do double-duty to make sure the counting and content are consistent, particularly when it comes
|
||||
* to awkward operations like measuring the encoded length of header strings, or the
|
||||
* length-in-digits of an encoded integer.
|
||||
*/
|
||||
private long writeOrCountBytes(BufferedSink sink, boolean countBytes) throws IOException {
|
||||
long byteCount = 0L;
|
||||
|
||||
Buffer byteCountBuffer = null;
|
||||
if (countBytes) {
|
||||
sink = byteCountBuffer = new Buffer();
|
||||
mContentLengthSize = new ArrayList<>();
|
||||
}
|
||||
|
||||
for (int p = 0, partCount = mParts.size(); p < partCount; p++) {
|
||||
Part part = mParts.get(p);
|
||||
Headers headers = part.headers;
|
||||
RequestBody body = part.body;
|
||||
|
||||
sink.write(DASHDASH);
|
||||
sink.write(mBoundary);
|
||||
sink.write(CRLF);
|
||||
|
||||
if (headers != null) {
|
||||
for (int h = 0, headerCount = headers.size(); h < headerCount; h++) {
|
||||
sink.writeUtf8(headers.name(h))
|
||||
.write(COLONSPACE)
|
||||
.writeUtf8(headers.value(h))
|
||||
.write(CRLF);
|
||||
}
|
||||
}
|
||||
|
||||
MediaType contentType = body.contentType();
|
||||
if (contentType != null) {
|
||||
sink.writeUtf8("Content-Type: ")
|
||||
.writeUtf8(contentType.toString())
|
||||
.write(CRLF);
|
||||
}
|
||||
|
||||
int contentLength = (int) body.contentLength();
|
||||
if (contentLength != -1) {
|
||||
sink.writeUtf8("Content-Length: ")
|
||||
.writeUtf8(contentLength + "")
|
||||
.write(CRLF);
|
||||
} else if (countBytes) {
|
||||
// We can't measure the body's size without the sizes of its components.
|
||||
byteCountBuffer.clear();
|
||||
return -1L;
|
||||
}
|
||||
|
||||
sink.write(CRLF);
|
||||
|
||||
if (countBytes) {
|
||||
byteCount += contentLength;
|
||||
mContentLengthSize.add(byteCount);
|
||||
} else {
|
||||
body.writeTo(sink);
|
||||
|
||||
// warn the listener of upload progress
|
||||
// sink.buffer().size() does not give the right value
|
||||
// assume that some data are popped
|
||||
if ((null != mContentLengthSize) && (p < mContentLengthSize.size())) {
|
||||
onWrite(mContentLengthSize.get(p));
|
||||
}
|
||||
}
|
||||
sink.write(CRLF);
|
||||
}
|
||||
|
||||
sink.write(DASHDASH);
|
||||
sink.write(mBoundary);
|
||||
sink.write(DASHDASH);
|
||||
sink.write(CRLF);
|
||||
|
||||
if (countBytes) {
|
||||
byteCount += byteCountBuffer.size();
|
||||
byteCountBuffer.clear();
|
||||
}
|
||||
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
private static void appendQuotedString(StringBuilder target, String key) {
|
||||
target.append('"');
|
||||
for (int i = 0, len = key.length(); i < len; i++) {
|
||||
char ch = key.charAt(i);
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
target.append("%0A");
|
||||
break;
|
||||
case '\r':
|
||||
target.append("%0D");
|
||||
break;
|
||||
case '"':
|
||||
target.append("%22");
|
||||
break;
|
||||
default:
|
||||
target.append(ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
target.append('"');
|
||||
}
|
||||
|
||||
public static final class Part {
|
||||
public static Part create(Headers headers, RequestBody body) {
|
||||
if (body == null) {
|
||||
throw new NullPointerException("body == null");
|
||||
}
|
||||
if (headers != null && headers.get("Content-Type") != null) {
|
||||
throw new IllegalArgumentException("Unexpected header: Content-Type");
|
||||
}
|
||||
if (headers != null && headers.get("Content-Length") != null) {
|
||||
throw new IllegalArgumentException("Unexpected header: Content-Length");
|
||||
}
|
||||
return new Part(headers, body);
|
||||
}
|
||||
|
||||
public static Part createFormData(String name, String value) {
|
||||
return createFormData(name, null, RequestBody.create(null, value));
|
||||
}
|
||||
|
||||
public static Part createFormData(String name, String filename, RequestBody body) {
|
||||
if (name == null) {
|
||||
throw new NullPointerException("name == null");
|
||||
}
|
||||
StringBuilder disposition = new StringBuilder("form-data; name=");
|
||||
appendQuotedString(disposition, name);
|
||||
|
||||
if (filename != null) {
|
||||
disposition.append("; filename=");
|
||||
appendQuotedString(disposition, filename);
|
||||
}
|
||||
|
||||
return create(Headers.of("Content-Disposition", disposition.toString()), body);
|
||||
}
|
||||
|
||||
final Headers headers;
|
||||
final RequestBody body;
|
||||
|
||||
private Part(Headers headers, RequestBody body) {
|
||||
this.headers = headers;
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private final ByteString boundary;
|
||||
private final List<Part> parts = new ArrayList<>();
|
||||
|
||||
public Builder() {
|
||||
this(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
public Builder(String boundary) {
|
||||
this.boundary = ByteString.encodeUtf8(boundary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a form data part to the body.
|
||||
*/
|
||||
public Builder addFormDataPart(String name, String value) {
|
||||
return addPart(Part.createFormData(name, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a form data part to the body.
|
||||
*/
|
||||
public Builder addFormDataPart(String name, String filename, RequestBody body) {
|
||||
return addPart(Part.createFormData(name, filename, body));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a part to the body.
|
||||
*/
|
||||
public Builder addPart(Part part) {
|
||||
if (part == null) throw new NullPointerException("part == null");
|
||||
parts.add(part);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assemble the specified parts into a request body.
|
||||
*/
|
||||
public BugReporterMultipartBody build() {
|
||||
if (parts.isEmpty()) {
|
||||
throw new IllegalStateException("Multipart body must have at least one part.");
|
||||
}
|
||||
return new BugReporterMultipartBody(boundary, parts);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.riotredesign.features.rageshake
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.hardware.Sensor
|
||||
import android.hardware.SensorManager
|
||||
import android.preference.PreferenceManager
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.edit
|
||||
import com.squareup.seismic.ShakeDetector
|
||||
import im.vector.riotredesign.R
|
||||
|
||||
class RageShake(val activity: Activity) : ShakeDetector.Listener {
|
||||
|
||||
private var shakeDetector: ShakeDetector? = null
|
||||
|
||||
private var dialogDisplayed = false
|
||||
|
||||
fun start() {
|
||||
if (!isEnable(activity)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
val sensorManager = activity.getSystemService(AppCompatActivity.SENSOR_SERVICE) as? SensorManager
|
||||
|
||||
if (sensorManager == null) {
|
||||
return
|
||||
}
|
||||
|
||||
shakeDetector = ShakeDetector(this).apply {
|
||||
start(sensorManager)
|
||||
}
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
shakeDetector?.stop()
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the feature, and start it
|
||||
*/
|
||||
fun enable() {
|
||||
PreferenceManager.getDefaultSharedPreferences(activity).edit {
|
||||
putBoolean(SETTINGS_USE_RAGE_SHAKE_KEY, true)
|
||||
}
|
||||
|
||||
start()
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the feature, and stop it
|
||||
*/
|
||||
fun disable() {
|
||||
PreferenceManager.getDefaultSharedPreferences(activity).edit {
|
||||
putBoolean(SETTINGS_USE_RAGE_SHAKE_KEY, false)
|
||||
}
|
||||
|
||||
stop()
|
||||
}
|
||||
|
||||
override fun hearShake() {
|
||||
if (dialogDisplayed) {
|
||||
// Filtered!
|
||||
return
|
||||
}
|
||||
|
||||
dialogDisplayed = true
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setMessage(R.string.send_bug_report_alert_message)
|
||||
.setPositiveButton(R.string.yes) { _, _ -> openBugReportScreen() }
|
||||
.setNeutralButton(R.string.disable) { _, _ -> disable() }
|
||||
.setOnDismissListener { dialogDisplayed = false }
|
||||
.setNegativeButton(R.string.no, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun openBugReportScreen() {
|
||||
BugReporter.sendBugReport(activity)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SETTINGS_USE_RAGE_SHAKE_KEY = "SETTINGS_USE_RAGE_SHAKE_KEY"
|
||||
|
||||
/**
|
||||
* Check if the feature is available
|
||||
*/
|
||||
fun isAvailable(context: Context): Boolean {
|
||||
return (context.getSystemService(AppCompatActivity.SENSOR_SERVICE) as? SensorManager)
|
||||
?.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) != null
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the feature is enable (enabled by default)
|
||||
*/
|
||||
private fun isEnable(context: Context): Boolean {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SETTINGS_USE_RAGE_SHAKE_KEY, true)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.ui.themes
|
||||
|
||||
import androidx.annotation.StyleRes
|
||||
import im.vector.riotredesign.R
|
||||
|
||||
/**
|
||||
* Class to manage Activity other possible themes.
|
||||
* Note that style for light theme is default and is declared in the Android Manifest
|
||||
*/
|
||||
sealed class ActivityOtherThemes(@StyleRes val dark: Int,
|
||||
@StyleRes val black: Int,
|
||||
@StyleRes val status: Int) {
|
||||
|
||||
object Default : ActivityOtherThemes(
|
||||
R.style.AppTheme_Dark,
|
||||
R.style.AppTheme_Black,
|
||||
R.style.AppTheme_Status
|
||||
)
|
||||
|
||||
object NoActionBarFullscreen : ActivityOtherThemes(
|
||||
R.style.AppTheme_NoActionBar_FullScreen_Dark,
|
||||
R.style.AppTheme_NoActionBar_FullScreen_Black,
|
||||
R.style.AppTheme_NoActionBar_FullScreen_Status
|
||||
)
|
||||
|
||||
object Home : ActivityOtherThemes(
|
||||
R.style.HomeActivityTheme_Dark,
|
||||
R.style.HomeActivityTheme_Black,
|
||||
R.style.HomeActivityTheme_Status
|
||||
)
|
||||
|
||||
object Group : ActivityOtherThemes(
|
||||
R.style.GroupAppTheme_Dark,
|
||||
R.style.GroupAppTheme_Black,
|
||||
R.style.GroupAppTheme_Status
|
||||
)
|
||||
|
||||
object Picker : ActivityOtherThemes(
|
||||
R.style.CountryPickerTheme_Dark,
|
||||
R.style.CountryPickerTheme_Black,
|
||||
R.style.CountryPickerTheme_Status
|
||||
)
|
||||
|
||||
object Lock : ActivityOtherThemes(
|
||||
R.style.Theme_Vector_Lock_Dark,
|
||||
R.style.Theme_Vector_Lock_Light,
|
||||
R.style.Theme_Vector_Lock_Status
|
||||
)
|
||||
|
||||
object Search : ActivityOtherThemes(
|
||||
R.style.SearchesAppTheme_Dark,
|
||||
R.style.SearchesAppTheme_Black,
|
||||
R.style.SearchesAppTheme_Status
|
||||
)
|
||||
|
||||
object Call : ActivityOtherThemes(
|
||||
R.style.CallActivityTheme_Dark,
|
||||
R.style.CallActivityTheme_Black,
|
||||
R.style.CallActivityTheme_Status
|
||||
)
|
||||
}
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* Copyright 2018 New Vector Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package im.vector.ui.themes
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.TextUtils
|
||||
import android.util.TypedValue
|
||||
import android.view.Menu
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import im.vector.riotredesign.R
|
||||
import timber.log.Timber
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Util class for managing themes.
|
||||
*/
|
||||
object ThemeUtils {
|
||||
const val LOG_TAG = "ThemeUtils"
|
||||
|
||||
// preference key
|
||||
const val APPLICATION_THEME_KEY = "APPLICATION_THEME_KEY"
|
||||
|
||||
// the theme possible values
|
||||
private const val THEME_DARK_VALUE = "dark"
|
||||
private const val THEME_LIGHT_VALUE = "light"
|
||||
private const val THEME_BLACK_VALUE = "black"
|
||||
private const val THEME_STATUS_VALUE = "status"
|
||||
|
||||
private val mColorByAttr = HashMap<Int, Int>()
|
||||
|
||||
/**
|
||||
* Provides the selected application theme
|
||||
*
|
||||
* @param context the context
|
||||
* @return the selected application theme
|
||||
*/
|
||||
fun getApplicationTheme(context: Context): String {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getString(APPLICATION_THEME_KEY, THEME_LIGHT_VALUE)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the application theme
|
||||
*
|
||||
* @param aTheme the new theme
|
||||
*/
|
||||
fun setApplicationTheme(context: Context, aTheme: String) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.edit()
|
||||
.putString(APPLICATION_THEME_KEY, aTheme)
|
||||
.apply()
|
||||
|
||||
/* TODO
|
||||
when (aTheme) {
|
||||
THEME_DARK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Dark)
|
||||
THEME_BLACK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Black)
|
||||
THEME_STATUS_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Status)
|
||||
else -> VectorApp.getInstance().setTheme(R.style.AppTheme_Light)
|
||||
}
|
||||
*/
|
||||
|
||||
mColorByAttr.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the activity theme according to the selected one.
|
||||
*
|
||||
* @param activity the activity
|
||||
*/
|
||||
fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) {
|
||||
when (getApplicationTheme(activity)) {
|
||||
THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark)
|
||||
THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black)
|
||||
THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status)
|
||||
}
|
||||
|
||||
mColorByAttr.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the TabLayout colors.
|
||||
* It seems that there is no proper way to manage it with the manifest file.
|
||||
*
|
||||
* @param activity the activity
|
||||
* @param layout the layout
|
||||
*/
|
||||
/*
|
||||
fun setTabLayoutTheme(activity: Activity, layout: TabLayout) {
|
||||
if (activity is VectorGroupDetailsActivity) {
|
||||
val textColor: Int
|
||||
val underlineColor: Int
|
||||
val backgroundColor: Int
|
||||
|
||||
if (TextUtils.equals(getApplicationTheme(activity), THEME_LIGHT_VALUE)) {
|
||||
textColor = ContextCompat.getColor(activity, android.R.color.white)
|
||||
underlineColor = textColor
|
||||
backgroundColor = ContextCompat.getColor(activity, R.color.tab_groups)
|
||||
} else if (TextUtils.equals(getApplicationTheme(activity), THEME_STATUS_VALUE)) {
|
||||
textColor = ContextCompat.getColor(activity, android.R.color.white)
|
||||
underlineColor = textColor
|
||||
backgroundColor = getColor(activity, R.attr.colorPrimary)
|
||||
} else {
|
||||
textColor = ContextCompat.getColor(activity, R.color.tab_groups)
|
||||
underlineColor = textColor
|
||||
backgroundColor = getColor(activity, R.attr.colorPrimary)
|
||||
}
|
||||
|
||||
layout.setTabTextColors(textColor, textColor)
|
||||
layout.setSelectedTabIndicatorColor(underlineColor)
|
||||
layout.setBackgroundColor(backgroundColor)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Translates color attributes to colors
|
||||
*
|
||||
* @param c Context
|
||||
* @param colorAttribute Color Attribute
|
||||
* @return Requested Color
|
||||
*/
|
||||
@ColorInt
|
||||
fun getColor(c: Context, @AttrRes colorAttribute: Int): Int {
|
||||
if (mColorByAttr.containsKey(colorAttribute)) {
|
||||
return mColorByAttr[colorAttribute] as Int
|
||||
}
|
||||
|
||||
var matchedColor: Int
|
||||
|
||||
try {
|
||||
val color = TypedValue()
|
||||
c.theme.resolveAttribute(colorAttribute, color, true)
|
||||
matchedColor = color.data
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Unable to get color")
|
||||
matchedColor = ContextCompat.getColor(c, android.R.color.holo_red_dark)
|
||||
}
|
||||
|
||||
mColorByAttr[colorAttribute] = matchedColor
|
||||
|
||||
return matchedColor
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resource Id applied to the current theme
|
||||
*
|
||||
* @param c the context
|
||||
* @param resourceId the resource id
|
||||
* @return the resource Id for the current theme
|
||||
*/
|
||||
fun getResourceId(c: Context, resourceId: Int): Int {
|
||||
if (TextUtils.equals(getApplicationTheme(c), THEME_LIGHT_VALUE)
|
||||
|| TextUtils.equals(getApplicationTheme(c), THEME_STATUS_VALUE)) {
|
||||
return when (resourceId) {
|
||||
R.drawable.line_divider_dark -> R.drawable.line_divider_light
|
||||
R.style.Floating_Actions_Menu -> R.style.Floating_Actions_Menu_Light
|
||||
else -> resourceId
|
||||
}
|
||||
}
|
||||
return resourceId
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the menu icons colors
|
||||
*
|
||||
* @param menu the menu
|
||||
* @param color the color
|
||||
*/
|
||||
fun tintMenuIcons(menu: Menu, color: Int) {
|
||||
for (i in 0 until menu.size()) {
|
||||
val item = menu.getItem(i)
|
||||
val drawable = item.icon
|
||||
if (drawable != null) {
|
||||
val wrapped = DrawableCompat.wrap(drawable)
|
||||
drawable.mutate()
|
||||
DrawableCompat.setTint(wrapped, color)
|
||||
item.icon = drawable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tint the drawable with a theme attribute
|
||||
*
|
||||
* @param context the context
|
||||
* @param drawable the drawable to tint
|
||||
* @param attribute the theme color
|
||||
* @return the tinted drawable
|
||||
*/
|
||||
fun tintDrawable(context: Context, drawable: Drawable, @AttrRes attribute: Int): Drawable {
|
||||
return tintDrawableWithColor(drawable, getColor(context, attribute))
|
||||
}
|
||||
|
||||
/**
|
||||
* Tint the drawable with a color integer
|
||||
*
|
||||
* @param drawable the drawable to tint
|
||||
* @param color the color
|
||||
* @return the tinted drawable
|
||||
*/
|
||||
fun tintDrawableWithColor(drawable: Drawable, @ColorInt color: Int): Drawable {
|
||||
val tinted = DrawableCompat.wrap(drawable)
|
||||
drawable.mutate()
|
||||
DrawableCompat.setTint(tinted, color)
|
||||
return tinted
|
||||
}
|
||||
}
|
5
app/src/main/res/color/button_text_color_selector.xml
Normal file
5
app/src/main/res/color/button_text_color_selector.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/button_disabled_text_color" android:state_enabled="false" />
|
||||
<item android:color="@color/button_enabled_text_color" />
|
||||
</selector>
|
5
app/src/main/res/color/home_bottom_nav_view_tint.xml
Normal file
5
app/src/main/res/color/home_bottom_nav_view_tint.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?attr/colorAccent" android:state_checked="true" />
|
||||
<item android:color="@color/vector_silver_color" />
|
||||
</selector>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/riot_primary_text_color_dark" android:state_enabled="true" />
|
||||
<item android:color="@color/riot_primary_text_color_disabled_dark" android:state_enabled="false" />
|
||||
</selector>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/riot_primary_text_color_light" android:state_enabled="true" />
|
||||
<item android:color="@color/riot_secondary_text_color_light" android:state_enabled="false" />
|
||||
</selector>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/riot_primary_text_color_status" android:state_enabled="true" />
|
||||
<item android:color="@color/riot_primary_text_color_disabled_status" android:state_enabled="false" />
|
||||
</selector>
|
BIN
app/src/main/res/drawable-xxhdpi/ic_material_send_black.png
Executable file
BIN
app/src/main/res/drawable-xxhdpi/ic_material_send_black.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 543 B |
22
app/src/main/res/drawable/bg_tombstone_predecessor.xml
Normal file
22
app/src/main/res/drawable/bg_tombstone_predecessor.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#F7F7F7" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:left="-2dp"
|
||||
android:right="-2dp"
|
||||
android:top="-2dp">
|
||||
<shape>
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#E4E4E4" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
||||
</layer-list>
|
8
app/src/main/res/drawable/call_header_transparent_bg.xml
Normal file
8
app/src/main/res/drawable/call_header_transparent_bg.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00000000"
|
||||
android:startColor="#8a000000"
|
||||
android:type="linear" />
|
||||
</shape>
|
11
app/src/main/res/drawable/direct_chat_circle_black.xml
Normal file
11
app/src/main/res/drawable/direct_chat_circle_black.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<!-- required on android < 4.2 devices -->
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@color/direct_chat_ring_color_black" />
|
||||
</shape>
|
11
app/src/main/res/drawable/direct_chat_circle_dark.xml
Normal file
11
app/src/main/res/drawable/direct_chat_circle_dark.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<!-- required on android < 4.2 devices -->
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@color/direct_chat_ring_color_dark" />
|
||||
</shape>
|
11
app/src/main/res/drawable/direct_chat_circle_light.xml
Normal file
11
app/src/main/res/drawable/direct_chat_circle_light.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<!-- required on android < 4.2 devices -->
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@color/direct_chat_ring_color_light" />
|
||||
</shape>
|
11
app/src/main/res/drawable/direct_chat_circle_status.xml
Normal file
11
app/src/main/res/drawable/direct_chat_circle_status.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<!-- required on android < 4.2 devices -->
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@color/direct_chat_ring_color_status" />
|
||||
</shape>
|
11
app/src/main/res/drawable/line_divider_dark.xml
Normal file
11
app/src/main/res/drawable/line_divider_dark.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<size
|
||||
android:width="1dp"
|
||||
android:height="1dp" />
|
||||
|
||||
<solid android:color="@color/list_divider_color_dark" />
|
||||
|
||||
</shape>
|
11
app/src/main/res/drawable/line_divider_light.xml
Normal file
11
app/src/main/res/drawable/line_divider_light.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<size
|
||||
android:width="1dp"
|
||||
android:height="1dp" />
|
||||
|
||||
<solid android:color="@color/list_divider_color_light" />
|
||||
|
||||
</shape>
|
6
app/src/main/res/drawable/pill_background_bing.xml
Normal file
6
app/src/main/res/drawable/pill_background_bing.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/vector_fuchsia_color" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#343a46" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#1A000000" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#1A000000" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#343a46" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#1A000000" />
|
||||
</shape>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="#1A000000" />
|
||||
</shape>
|
16
app/src/main/res/drawable/riot_animated_logo.xml
Normal file
16
app/src/main/res/drawable/riot_animated_logo.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<!--item
|
||||
android:drawable="@drawable/riot_splash_0_blue"
|
||||
android:duration="@integer/splash_animation_velocity" />
|
||||
<item
|
||||
android:drawable="@drawable/riot_splash_1_green"
|
||||
android:duration="@integer/splash_animation_velocity" />
|
||||
<item
|
||||
android:drawable="@drawable/riot_splash_2_pink"
|
||||
android:duration="@integer/splash_animation_velocity" />
|
||||
<item
|
||||
android:drawable="@drawable/riot_splash_3_red"
|
||||
android:duration="@integer/splash_animation_velocity" /-->
|
||||
</animation-list>
|
5
app/src/main/res/drawable/searches_cursor_background.xml
Normal file
5
app/src/main/res/drawable/searches_cursor_background.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size android:width="1dp" />
|
||||
<solid android:color="#7D7D7D" />
|
||||
</shape>
|
9
app/src/main/res/drawable/shadow_bottom_dark.xml
Normal file
9
app/src/main/res/drawable/shadow_bottom_dark.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#1a1a1a"
|
||||
android:startColor="#212121"
|
||||
android:type="linear" />
|
||||
</shape>
|
9
app/src/main/res/drawable/shadow_bottom_light.xml
Executable file
9
app/src/main/res/drawable/shadow_bottom_light.xml
Executable file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#c0c0c0"
|
||||
android:startColor="#e1e1e1"
|
||||
android:type="linear" />
|
||||
</shape>
|
8
app/src/main/res/drawable/shadow_top_dark.xml
Normal file
8
app/src/main/res/drawable/shadow_top_dark.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#212121"
|
||||
android:startColor="#1a1a1a" />
|
||||
</shape>
|
8
app/src/main/res/drawable/shadow_top_light.xml
Executable file
8
app/src/main/res/drawable/shadow_top_light.xml
Executable file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#e1e1e1"
|
||||
android:startColor="#d3d3d3" />
|
||||
</shape>
|
17
app/src/main/res/drawable/splash.xml
Normal file
17
app/src/main/res/drawable/splash.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- The android:opacity=”opaque” line — this is critical in preventing a flash of black as your theme transitions. -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:opacity="opaque">
|
||||
|
||||
<!-- Background color -->
|
||||
<item android:drawable="@color/riot_primary_background_color_light" />
|
||||
|
||||
<!-- Centered logo -->
|
||||
<!--item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/riot_splash_0_blue" />
|
||||
</item-->
|
||||
|
||||
</layer-list>
|
11
app/src/main/res/drawable/sticker_description_background.xml
Normal file
11
app/src/main/res/drawable/sticker_description_background.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/list_divider_color_light" />
|
||||
<padding
|
||||
android:bottom="5dp"
|
||||
android:left="8dp"
|
||||
android:right="5dp"
|
||||
android:top="5dp" />
|
||||
</shape>
|
13
app/src/main/res/drawable/sticker_description_triangle.xml
Normal file
13
app/src/main/res/drawable/sticker_description_triangle.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="15dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="100"
|
||||
android:viewportHeight="100">
|
||||
<group android:name="triableGroup">
|
||||
<path
|
||||
android:name="triangle"
|
||||
android:fillColor="#339D9D9D"
|
||||
android:pathData="m 50,0 l 50,100 -100,0 z" />
|
||||
</group>
|
||||
</vector>
|
10
app/src/main/res/drawable/vector_background_fab_label.xml
Normal file
10
app/src/main/res/drawable/vector_background_fab_label.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#4d4d4d" />
|
||||
<padding
|
||||
android:bottom="4dp"
|
||||
android:left="16dp"
|
||||
android:right="16dp"
|
||||
android:top="4dp" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFF2F2F2" />
|
||||
<padding
|
||||
android:bottom="4dp"
|
||||
android:left="16dp"
|
||||
android:right="16dp"
|
||||
android:top="4dp" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#28000000" />
|
||||
<corners
|
||||
android:bottomLeftRadius="23dp"
|
||||
android:bottomRightRadius="23dp"
|
||||
android:topLeftRadius="23dp"
|
||||
android:topRightRadius="23dp" />
|
||||
</shape>
|
21
app/src/main/res/drawable/vector_tabbar_background_dark.xml
Normal file
21
app/src/main/res/drawable/vector_tabbar_background_dark.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_dark" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_dark" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_dark" android:state_focused="true" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_dark" android:state_focused="true" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Pressed -->
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_dark" android:state_focused="false" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_dark" android:state_focused="false" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_dark" android:state_focused="true" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_dark" android:state_focused="true" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_group_light" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_group_light" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_group_light" android:state_focused="true" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_group_light" android:state_focused="true" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Pressed -->
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_group_light" android:state_focused="false" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_group_light" android:state_focused="false" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_group_light" android:state_focused="true" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_group_light" android:state_focused="true" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
</selector>
|
21
app/src/main/res/drawable/vector_tabbar_background_light.xml
Normal file
21
app/src/main/res/drawable/vector_tabbar_background_light.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_light" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_light" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_light" android:state_focused="true" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_light" android:state_focused="true" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Pressed -->
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_light" android:state_focused="false" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_light" android:state_focused="false" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_light" android:state_focused="true" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_light" android:state_focused="true" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_status" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_status" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_status" android:state_focused="true" android:state_pressed="false" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_status" android:state_focused="true" android:state_pressed="false" android:state_selected="true" />
|
||||
|
||||
<!-- Pressed -->
|
||||
<!-- Non focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_status" android:state_focused="false" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_status" android:state_focused="false" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
<!-- Focused states -->
|
||||
<item android:drawable="@drawable/vector_tabbar_unselected_background_status" android:state_focused="true" android:state_pressed="true" android:state_selected="false" />
|
||||
<item android:drawable="@drawable/vector_tabbar_selected_background_status" android:state_focused="true" android:state_pressed="true" android:state_selected="true" />
|
||||
|
||||
</selector>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/list_divider_color_dark" />
|
||||
<padding android:bottom="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<padding android:bottom="2dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_selected_background_color_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/list_divider_color_light" />
|
||||
<padding android:bottom="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<padding android:bottom="2dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_groups" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/list_divider_color_light" />
|
||||
<padding android:bottom="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<padding android:bottom="2dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_selected_background_color_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/list_divider_color_light" />
|
||||
<padding android:bottom="1dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<padding android:bottom="2dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_selected_background_color_status" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_unselected_background_color_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_groups" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_unselected_background_color_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/tab_bar_unselected_background_color_status" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
192
app/src/main/res/layout/activity_bug_report.xml
Normal file
192
app/src/main/res/layout/activity_bug_report.xml
Normal file
|
@ -0,0 +1,192 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bug_report_body_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bug_report_progress_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/send_bug_report_progress"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/bug_report_progress_view"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="70"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/bug_report_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/send_bug_report_description" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColorHint="?attr/vctr_default_text_hint_color">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/bug_report_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_bug_report_placeholder"
|
||||
android:minHeight="40dp"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/send_bug_report_description_in_english"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/send_bug_report_logs_description" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/bug_report_button_include_logs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/send_bug_report_include_logs" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/bug_report_button_include_crash_logs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/send_bug_report_include_crash_logs" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/bug_report_button_include_screenshot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/send_bug_report_include_screenshot" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bug_report_screenshot_preview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:maxWidth="260dp"
|
||||
android:scaleType="fitCenter"
|
||||
tools:src="@tools:sample/backgrounds/scenic" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/bug_report_mask_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:clickable="true"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
12
app/src/main/res/menu/bug_report.xml
Executable file
12
app/src/main/res/menu/bug_report.xml
Executable file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu 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"
|
||||
tools:context="org.matrix.vector.activity.RoomActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/ic_action_send_bug_report"
|
||||
android:icon="@drawable/ic_material_send_black"
|
||||
android:title="@string/send_bug_report"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
95
app/src/main/res/values/attrs.xml
Normal file
95
app/src/main/res/values/attrs.xml
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="VectorStyles">
|
||||
|
||||
<attr name="vctr_bottom_nav_background_color" format="color" />
|
||||
|
||||
<!-- waiting view background -->
|
||||
<attr name="vctr_waiting_background_color" format="color" />
|
||||
|
||||
<!-- application bar text color -->
|
||||
<attr name="vctr_toolbar_primary_text_color" format="color" />
|
||||
<attr name="vctr_toolbar_secondary_text_color" format="color" />
|
||||
<attr name="vctr_toolbar_link_text_color" format="color" />
|
||||
|
||||
<!-- application bar text hint color -->
|
||||
<attr name="vctr_primary_hint_text_color" format="color" />
|
||||
|
||||
<!-- default text colors -->
|
||||
<attr name="vctr_default_text_hint_color" format="color" />
|
||||
|
||||
<!-- room message colors -->
|
||||
<attr name="vctr_unread_room_indent_color" format="color" />
|
||||
<attr name="vctr_unsent_message_text_color" format="color" />
|
||||
<attr name="vctr_message_text_color" format="color" />
|
||||
<attr name="vctr_notice_text_color" format="color" />
|
||||
<attr name="vctr_notice_secondary" format="color" />
|
||||
<attr name="vctr_encrypting_message_text_color" format="color" />
|
||||
<attr name="vctr_sending_message_text_color" format="color" />
|
||||
<attr name="vctr_highlighted_message_text_color" format="color" />
|
||||
<attr name="vctr_highlighted_searched_message_text_color" format="color" />
|
||||
<attr name="vctr_search_mode_room_name_text_color" format="color" />
|
||||
<attr name="vctr_unread_marker_line_color" format="color" />
|
||||
<attr name="vctr_markdown_block_background_color" format="color" />
|
||||
<attr name="vctr_room_activity_divider_color" format="color" />
|
||||
|
||||
<!-- tab bar colors -->
|
||||
<attr name="vctr_tab_bar_inverted_background_color" format="color" />
|
||||
<attr name="vctr_tab_bar_selected_background_color" format="color" />
|
||||
<attr name="vctr_tab_bar_unselected_background_color" format="color" />
|
||||
|
||||
<!-- list colors -->
|
||||
<attr name="vctr_list_header_background_color" format="color" />
|
||||
<attr name="vctr_list_header_primary_text_color" format="color" />
|
||||
<attr name="vctr_list_header_secondary_text_color" format="color" />
|
||||
|
||||
<attr name="vctr_list_divider_color" format="color" />
|
||||
|
||||
<!-- gradient on the bottom of some activities -->
|
||||
<attr name="vctr_activity_bottom_gradient_color" format="color" />
|
||||
|
||||
<!-- outgoing call background color -->
|
||||
<attr name="vctr_pending_outgoing_view_background_color" format="color" />
|
||||
|
||||
<!-- multi selection member background color -->
|
||||
<attr name="vctr_multi_selection_background_color" format="color" />
|
||||
|
||||
<!-- sliding menu icon colors -->
|
||||
<attr name="vctr_home_navigation_icon_color" format="color" />
|
||||
|
||||
<!-- room notification text color (typing, unsent...) -->
|
||||
<attr name="vctr_room_notification_text_color" format="color" />
|
||||
|
||||
<!-- color for dividers in settings -->
|
||||
<attr name="vctr_preference_divider_color" format="color" />
|
||||
|
||||
<!-- icon colors -->
|
||||
<attr name="vctr_icon_tint_on_light_action_bar_color" format="color" />
|
||||
<attr name="vctr_icon_tint_on_dark_action_bar_color" format="color" />
|
||||
<attr name="vctr_settings_icon_tint_color" format="color" />
|
||||
|
||||
<!-- Tab home colors -->
|
||||
<attr name="vctr_tab_home" format="color" />
|
||||
<attr name="vctr_tab_home_secondary" format="color" />
|
||||
|
||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||
<!-- dedicated drawables are created for each theme -->
|
||||
<attr name="vctr_line_divider" format="reference" />
|
||||
<attr name="vctr_shadow_bottom" format="reference" />
|
||||
<attr name="vctr_shadow_top" format="reference" />
|
||||
<attr name="vctr_tabbar_selected_background" format="reference" />
|
||||
<attr name="vctr_tabbar_unselected_background" format="reference" />
|
||||
<attr name="vctr_tabbar_background" format="reference" />
|
||||
<attr name="vctr_direct_chat_circle" format="reference" />
|
||||
|
||||
<attr name="vctr_pill_background_user_id" format="reference" />
|
||||
<attr name="vctr_pill_background_room_alias" format="reference" />
|
||||
<attr name="vctr_pill_text_color_user_id" format="reference" />
|
||||
<attr name="vctr_pill_text_color_room_alias" format="reference" />
|
||||
|
||||
<!-- Widget banner background -->
|
||||
<attr name="vctr_widget_banner_background" format="color" />
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
|
@ -18,8 +18,4 @@
|
|||
<color name="brown_grey">#a5a5a5</color>
|
||||
<color name="grey_lynch">#61708B</color>
|
||||
|
||||
<color name="vector_silver_color">#FFC7C7C7</color>
|
||||
<color name="vector_dark_grey_color">#FF999999</color>
|
||||
<color name="vector_fuchsia_color">#FFF56679</color>
|
||||
|
||||
</resources>
|
||||
|
|
150
app/src/main/res/values/colors_riot.xml
Normal file
150
app/src/main/res/values/colors_riot.xml
Normal file
|
@ -0,0 +1,150 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Error colors -->
|
||||
<color name="vector_success_color">#70BF56</color>
|
||||
<color name="vector_warning_color">#ff4b55</color>
|
||||
<color name="vector_error_color">#ff4b55</color>
|
||||
|
||||
<!-- main app colors -->
|
||||
<color name="vector_fuchsia_color">#ff4b55</color>
|
||||
<color name="vector_silver_color">#FFC7C7C7</color>
|
||||
<color name="vector_dark_grey_color">#FF999999</color>
|
||||
|
||||
<!-- home activity tab bar color -->
|
||||
<color name="tab_favourites">#BD79CC</color>
|
||||
<color name="tab_favourites_secondary">#744C7F</color>
|
||||
<color name="tab_people">#F8A15F</color>
|
||||
<color name="tab_people_secondary">#D97051</color>
|
||||
<color name="tab_rooms">@color/accent_color_light</color>
|
||||
<color name="tab_rooms_secondary">#5EA584</color>
|
||||
<color name="tab_groups">#a6d0e5</color>
|
||||
<color name="tab_groups_secondary">#81bddb</color>
|
||||
|
||||
<!-- color of the direct chat avatar ring (it's 50% of color accent) -->
|
||||
<color name="direct_chat_ring_color_light">#7F03b381</color>
|
||||
<color name="direct_chat_ring_color_dark">#7F03b381</color>
|
||||
<color name="direct_chat_ring_color_black">#7F03b381</color>
|
||||
<color name="direct_chat_ring_color_status">#7F586C7B</color>
|
||||
|
||||
<!-- theses colours are requested a background cannot be set by an ?attr on android < 5 -->
|
||||
<!-- dedicated drawables are created for each theme -->
|
||||
<!-- Default/Background-->
|
||||
<color name="riot_primary_background_color_light">#FFFFFFFF</color>
|
||||
<!-- Dark/Background-->
|
||||
<color name="riot_primary_background_color_dark">#FF181B21</color>
|
||||
<!-- Black/Background-->
|
||||
<color name="riot_primary_background_color_black">#F000</color>
|
||||
<color name="riot_primary_background_color_status">#FFEEF2F5</color>
|
||||
|
||||
<!--Default/Android Status Bar-->
|
||||
<color name="primary_color_dark_light">#FF1A2027</color>
|
||||
<!--Default/Base-->
|
||||
<color name="primary_color_light">#FF27303A</color>
|
||||
<!--Default/Accent-->
|
||||
<color name="accent_color_light">#03b381</color>
|
||||
|
||||
<!--Dark/Android Status Bar-->
|
||||
<color name="primary_color_dark_dark">#FF0D0E10</color>
|
||||
<!--Dark/Base-->
|
||||
<color name="primary_color_dark">#FF15171B</color>
|
||||
<!--Dark/Accent-->
|
||||
<color name="accent_color_dark">#03b381</color>
|
||||
|
||||
<!--Black/Android Status Bar-->
|
||||
<color name="primary_color_dark_black">#000</color>
|
||||
<!--Black/Base-->
|
||||
<color name="primary_color_black">#FF060708</color>
|
||||
|
||||
<color name="primary_color_dark_status">#FF465561</color>
|
||||
<color name="primary_color_status">#FF586C7B</color>
|
||||
<color name="accent_color_status">#FF586C7B</color>
|
||||
|
||||
<!--Default/Line break mobile-->
|
||||
<color name="list_divider_color_light">#EEEFEF</color>
|
||||
<!--Dark/Line break mobile-->
|
||||
<color name="list_divider_color_dark">#FF61708B</color>
|
||||
<!--Black/Line break mobile-->
|
||||
<color name="list_divider_color_black">#FF22262E</color>
|
||||
|
||||
<color name="tab_bar_selected_background_color_light">@color/primary_color_light</color>
|
||||
<color name="tab_bar_selected_background_color_dark">@color/primary_color_dark</color>
|
||||
<color name="tab_bar_selected_background_color_status">@color/primary_color_status</color>
|
||||
|
||||
<color name="tab_bar_unselected_background_color_light">@color/primary_color_light</color>
|
||||
<color name="tab_bar_unselected_background_color_dark">@color/primary_color_dark</color>
|
||||
<color name="tab_bar_unselected_background_color_status">@color/primary_color_status</color>
|
||||
|
||||
<!-- Hint Colors -->
|
||||
<color name="primary_hint_text_color_light">#FFFFFF</color>
|
||||
<color name="primary_hint_text_color_dark">#FFFFFF</color>
|
||||
|
||||
<color name="default_text_hint_color_light">#903C3C3C</color>
|
||||
<color name="default_text_hint_color_dark">#CCDDDDDD</color>
|
||||
|
||||
<!-- Text Colors -->
|
||||
<!--Default/Text Primary-->
|
||||
<color name="riot_primary_text_color_light">#FF2E2F32</color>
|
||||
<color name="riot_primary_text_color_disabled_light">#FF9E9E9E</color>
|
||||
<!--Default/Text Secondary-->
|
||||
<color name="riot_secondary_text_color_light">#FF9E9E9E</color>
|
||||
<color name="riot_tertiary_text_color_light">@color/riot_primary_text_color_light</color>
|
||||
|
||||
<!--Dark /Text Primary-->
|
||||
<color name="riot_primary_text_color_dark">#FFEDF3FF</color>
|
||||
<color name="riot_primary_text_color_disabled_dark">#FFA1B2D1</color>
|
||||
<!--Dark /Text Secondary-->
|
||||
<color name="riot_secondary_text_color_dark">#FFA1B2D1</color>
|
||||
<color name="riot_tertiary_text_color_dark">@color/riot_primary_text_color_dark</color>
|
||||
|
||||
<!-- Status/Text Primary-->
|
||||
<color name="riot_primary_text_color_status">#FF70808D</color>
|
||||
<color name="riot_primary_text_color_disabled_status">#7F70808D</color>
|
||||
<!-- Status/Text Secondary-->
|
||||
<color name="riot_secondary_text_color_status">#7F70808D</color>
|
||||
<color name="riot_tertiary_text_color_status">@color/riot_primary_text_color_status</color>
|
||||
|
||||
<!-- Quote Colors -->
|
||||
<color name="quote_strip_color">#FFDDDDDD</color>
|
||||
<color name="quote_background_color">@android:color/transparent</color>
|
||||
|
||||
<!-- Notification view colors -->
|
||||
<color name="soft_resource_limit_exceeded">#2f9edb</color>
|
||||
<color name="hard_resource_limit_exceeded">@color/vector_fuchsia_color</color>
|
||||
|
||||
<!-- Avatar colors -->
|
||||
<color name="avatar_color_1">#03b381</color>
|
||||
<color name="avatar_color_2">#368bd6</color>
|
||||
<color name="avatar_color_3">#ac3ba8</color>
|
||||
|
||||
<!-- Password Strength bar colors -->
|
||||
<color name="password_strength_bar_weak">#FFF56679</color>
|
||||
<color name="password_strength_bar_low">#FFFFC666</color>
|
||||
<color name="password_strength_bar_ok">#FFF8E71C</color>
|
||||
<color name="password_strength_bar_strong">#FF7AC9A1</color>
|
||||
<color name="password_strength_bar_undefined">#FF9E9E9E</color>
|
||||
|
||||
<!-- Button color -->
|
||||
<color name="button_enabled_text_color">#FFFFFFFF</color>
|
||||
<color name="button_disabled_text_color">#FF7F7F7F</color>
|
||||
|
||||
<!-- User names color -->
|
||||
<color name="username_1">#368bd6</color>
|
||||
<color name="username_2">#ac3ba8</color>
|
||||
<color name="username_3">#03b381</color>
|
||||
<color name="username_4">#e64f7a</color>
|
||||
<color name="username_5">#ff812d</color>
|
||||
<color name="username_6">#2dc2c5</color>
|
||||
<color name="username_7">#5c56f5</color>
|
||||
<color name="username_8">#74d12c</color>
|
||||
|
||||
<!-- Link color -->
|
||||
<color name="link_color_light">#368BD6</color>
|
||||
<color name="link_color_dark">#368BD6</color>
|
||||
<color name="link_color_status">#368BD6</color>
|
||||
|
||||
<!-- Notification (do not depends on theme -->
|
||||
<color name="notification_accent_color">#368BD6</color>
|
||||
|
||||
|
||||
</resources>
|
|
@ -1,4 +0,0 @@
|
|||
<resources>
|
||||
|
||||
|
||||
</resources>
|
249
app/src/main/res/values/styles_riot.xml
Normal file
249
app/src/main/res/values/styles_riot.xml
Normal file
|
@ -0,0 +1,249 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- ************************ Common items ************************ -->
|
||||
|
||||
<!-- Launcher Theme, only used for VectorLauncherActivity (will be use even before the Activity is started) -->
|
||||
<style name="AppTheme.Launcher" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/splash</item>
|
||||
|
||||
<item name="colorPrimaryDark">@color/primary_color_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- toolbar styles-->
|
||||
<style name="VectorToolbarStyle" parent="Widget.AppCompat.Toolbar">
|
||||
<item name="android:background">?colorPrimary</item>
|
||||
<item name="background">?colorPrimary</item>
|
||||
|
||||
<!-- main text -->
|
||||
<item name="titleTextAppearance">@style/Vector.Toolbar.Title</item>
|
||||
<item name="subtitleTextAppearance">@style/Vector.Toolbar.SubTitle</item>
|
||||
|
||||
<item name="theme">@style/VectorToolbarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorToolbarStyle.Group">
|
||||
<item name="android:background">@color/tab_groups</item>
|
||||
<item name="background">@color/tab_groups</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorToolbarTheme">
|
||||
<!-- toolbar icons -->
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.Toolbar.Title" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textColor">?attr/vctr_toolbar_primary_text_color</item>
|
||||
<item name="android:fontFamily">"sans-serif-medium"</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.Toolbar.SubTitle" parent="TextAppearance.Widget.AppCompat.Toolbar.Subtitle">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textColor">?attr/vctr_toolbar_primary_text_color</item>
|
||||
<item name="android:fontFamily">"sans-serif"</item>
|
||||
</style>
|
||||
|
||||
<!-- tabbar text color -->
|
||||
<style name="Vector.TabText" parent="Widget.AppCompat.ActionBar.TabText">
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Vector.PopupMenuBase" parent="Widget.AppCompat.PopupMenu">
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:dropDownHorizontalOffset">0dp</item>
|
||||
<item name="android:dropDownVerticalOffset">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.PopupMenu" parent="Vector.PopupMenuBase">
|
||||
<!--
|
||||
Before Lollipop the popup background is white on dark theme, so force color here.
|
||||
(v21 will revert back to default drawable)
|
||||
-->
|
||||
<item name="android:popupBackground">?colorBackgroundFloating</item>
|
||||
</style>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<style name="Vector.ActionBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
|
||||
<item name="colorControlNormal">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<!-- custom action bar -->
|
||||
<style name="Vector.Styled.ActionBar" parent="Widget.AppCompat.Toolbar">
|
||||
<item name="android:background">?colorPrimary</item>
|
||||
<item name="background">?colorPrimary</item>
|
||||
|
||||
<!-- remove shadow under the action bar -->
|
||||
<item name="elevation">0dp</item>
|
||||
|
||||
<!-- main text -->
|
||||
<item name="titleTextStyle">@style/ActionBarTitleText</item>
|
||||
|
||||
<!-- sub text -->
|
||||
<item name="subtitleTextStyle">@style/ActionBarSubTitleText</item>
|
||||
</style>
|
||||
|
||||
<!-- main text -->
|
||||
<style name="ActionBarTitleText" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">?attr/vctr_toolbar_primary_text_color</item>
|
||||
<item name="android:fontFamily">"sans-serif-medium"</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
</style>
|
||||
|
||||
<!-- sub text -->
|
||||
<style name="ActionBarSubTitleText" parent="TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
|
||||
<item name="android:textColor">?attr/vctr_toolbar_primary_text_color</item>
|
||||
<item name="android:fontFamily">"sans-serif-medium"</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
|
||||
<!-- home scroller menu -->
|
||||
<style name="NavigationViewStyle">
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<!-- Styles for login screen -->
|
||||
<style name="LoginEditTextStyle" parent="Widget.AppCompat.EditText">
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
|
||||
<!-- Styles for button -->
|
||||
<!--
|
||||
Widget.AppCompat.Button.Colored, which sets the button color to colorAccent,
|
||||
using colorControlHighlight as an overlay for focused and pressed states.
|
||||
-->
|
||||
<style name="VectorButtonStyle" parent="Widget.AppCompat.Button.Colored">
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:minWidth">94dp</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textColor">@color/button_text_color_selector</item>
|
||||
</style>
|
||||
|
||||
<!--Widget.AppCompat.Button.Borderless.Colored, which sets the text color to colorAccent,
|
||||
using colorControlHighlight as an overlay for focused and pressed states.-->
|
||||
<style name="VectorButtonStyleFlat" parent="Widget.AppCompat.Button.Borderless.Colored">
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="colorControlHighlight">?colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorSearches.EditText" parent="Widget.AppCompat.EditText">
|
||||
<item name="android:textCursorDrawable">@drawable/searches_cursor_background</item>
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<item name="background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorSearches.Styled.ActionBar" parent="Vector.Styled.ActionBar">
|
||||
<item name="android:background">?android:attr/colorBackground</item>
|
||||
<item name="background">?android:attr/colorBackground</item>
|
||||
</style>
|
||||
|
||||
<!-- tabbar text color -->
|
||||
<style name="VectorSearches.TabText" parent="Widget.AppCompat.ActionBar.TabText">
|
||||
<item name="android:textColor">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorSearches.ActionBarTheme" parent="ThemeOverlay.AppCompat.ActionBar">
|
||||
<item name="colorControlNormal">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorPeopleSearches.TabLayout" parent="Widget.Design.TabLayout">
|
||||
<item name="tabGravity">fill</item>
|
||||
<item name="tabMode">fixed</item>
|
||||
<item name="tabPaddingStart">0dp</item>
|
||||
<item name="tabPaddingEnd">0dp</item>
|
||||
<item name="tabBackground">?attr/colorAccent</item>
|
||||
<item name="tabTextColor">@android:color/white</item>
|
||||
<item name="tabSelectedTextColor">@android:color/white</item>
|
||||
<item name="tabIndicatorColor">@android:color/white</item>
|
||||
<item name="tabMaxWidth">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="VectorUnifiedSearches.TabLayout" parent="Widget.Design.TabLayout">
|
||||
<item name="tabGravity">fill</item>
|
||||
<item name="tabMode">fixed</item>
|
||||
<item name="tabPaddingStart">0dp</item>
|
||||
<item name="tabPaddingEnd">0dp</item>
|
||||
<item name="tabBackground">?attr/vctr_tab_bar_inverted_background_color</item>
|
||||
<item name="tabTextColor">?attr/colorAccent</item>
|
||||
<item name="tabSelectedTextColor">?attr/colorAccent</item>
|
||||
<item name="tabIndicatorColor">?attr/colorAccent</item>
|
||||
<item name="tabMaxWidth">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="ListHeader">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">?vctr_list_header_primary_text_color</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:fontFamily">sans-serif-medium</item>
|
||||
<item name="android:background">?vctr_list_header_background_color</item>
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingTop">10dp</item>
|
||||
<item name="android:paddingBottom">10dp</item>
|
||||
</style>
|
||||
|
||||
<style name="SpinnerTheme">
|
||||
<item name="colorControlNormal">?attr/vctr_list_header_primary_text_color</item>
|
||||
</style>
|
||||
|
||||
<style name="PopMenuStyle" parent="Widget.AppCompat.PopupMenu">
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<!--style name="Floating_Action_Button">
|
||||
<item name="fab_labelsPosition">left</item>
|
||||
</style-->
|
||||
|
||||
<style name="Floating_Actions_Menu">
|
||||
<item name="android:background">@drawable/vector_background_fab_label</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Floating_Actions_Menu.Light">
|
||||
<item name="android:background">@drawable/vector_background_fab_label_light</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.TabView.Group" parent="Widget.AppCompat.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/vector_tabbar_background_group_light</item>
|
||||
<item name="background">@drawable/vector_tabbar_background_group_light</item>
|
||||
</style>
|
||||
|
||||
<!-- Linear Layout orientation, depending on screen size. Vertical by default -->
|
||||
<style name="VectorLinearLayout">
|
||||
<item name="android:gravity">end</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
</style>
|
||||
|
||||
<!-- BottomSheet theming -->
|
||||
<style name="Vector.BottomSheet.Dark" parent="Theme.Design.BottomSheetDialog">
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_dark</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_dark</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.BottomSheet.Light" parent="Theme.Design.Light.BottomSheetDialog">
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_light</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_light</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_light</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.BottomSheet.Status" parent="Theme.Design.Light.BottomSheetDialog">
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_status</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_status</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_status</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
115
app/src/main/res/values/theme_black.xml
Normal file
115
app/src/main/res/values/theme_black.xml
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- BLACK THEME COLORS -->
|
||||
|
||||
<style name="AppTheme.Base.Black" parent="AppTheme.Base.Dark">
|
||||
<!-- Only setting the items we need to override to get the background to be pure black, otherwise inheriting -->
|
||||
|
||||
<item name="colorPrimaryDark">@color/primary_color_dark_black</item>
|
||||
<item name="colorPrimary">@color/primary_color_black</item>
|
||||
|
||||
<!-- list colors -->
|
||||
<!--Header/Panel Background-->
|
||||
<item name="vctr_list_header_background_color">#FF090A0C</item>
|
||||
<!--Header/Panel Text Primary-->
|
||||
<item name="vctr_tab_home">@color/primary_color_black</item>
|
||||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_tab_home_secondary">@color/primary_color_dark_black</item>
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_black</item>
|
||||
|
||||
<!-- color for dividers in settings -->
|
||||
<item name="vctr_preference_divider_color">@color/list_divider_color_black</item>
|
||||
|
||||
<item name="android:colorBackground">@color/riot_primary_background_color_black</item>
|
||||
<item name="vctr_markdown_block_background_color">#FF4D4D4D</item>
|
||||
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@color/riot_primary_background_color_black</item>
|
||||
<item name="vctr_bottom_nav_background_color">@color/primary_color_black</item>
|
||||
|
||||
<item name="vctr_direct_chat_circle">@drawable/direct_chat_circle_black</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Black" parent="AppTheme.Base.Black" />
|
||||
|
||||
<style name="Theme.Vector.Lock.Black" parent="Theme.Vector.Lock.Dark">
|
||||
<item name="colorPrimary">@color/riot_primary_background_color_black</item>
|
||||
<item name="android:colorBackground">@color/riot_primary_background_color_black</item>
|
||||
</style>
|
||||
|
||||
<!-- home activity -->
|
||||
<style name="HomeActivityTheme.Black" parent="AppTheme.Black">
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textColorHint">?attr/vctr_default_text_hint_color</item>
|
||||
</style>
|
||||
|
||||
<!-- call activity -->
|
||||
<style name="CallActivityTheme.Black" parent="AppTheme.Black">
|
||||
<!-- status bar color -->
|
||||
<item name="colorPrimaryDark">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<!-- NoActionBar + FullScreen -->
|
||||
<style name="AppTheme.NoActionBar.FullScreen.Black" parent="AppTheme.Black">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Picker activities -->
|
||||
<style name="CountryPickerTheme.Black" parent="AppTheme.Black">
|
||||
<item name="editTextColor">@android:color/white</item>
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">?attr/vctr_activity_bottom_gradient_color</item>
|
||||
</style>
|
||||
|
||||
<!-- searches activity -->
|
||||
<style name="SearchesAppTheme.Black" parent="AppTheme.Black">
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- edit text -->
|
||||
<item name="android:editTextStyle">@style/VectorSearches.EditText</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/VectorSearches.ActionBarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="CallAppTheme.Black" parent="AppTheme.Black">
|
||||
<item name="android:colorBackground">?attr/colorBackgroundFloating</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowTitleStyle">@style/RtlOverlay.DialogWindowTitle.AppCompat</item>
|
||||
<item name="android:windowTitleBackgroundStyle">
|
||||
@style/Base.DialogWindowTitleBackground.AppCompat
|
||||
</item>
|
||||
<item name="android:windowBackground">@drawable/abc_dialog_material_background</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="listPreferredItemPaddingLeft">24dip</item>
|
||||
<item name="listPreferredItemPaddingRight">24dip</item>
|
||||
|
||||
<item name="android:listDivider">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="GroupAppTheme.Black" parent="AppTheme.Black">
|
||||
<item name="colorPrimaryDark">@color/tab_groups_secondary</item>
|
||||
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
263
app/src/main/res/values/theme_dark.xml
Normal file
263
app/src/main/res/values/theme_dark.xml
Normal file
|
@ -0,0 +1,263 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- DARK THEME COLORS -->
|
||||
|
||||
<style name="AppTheme.Base.Dark" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="colorPrimaryDark">@color/primary_color_dark_dark</item>
|
||||
<item name="colorPrimary">@color/primary_color_dark</item>
|
||||
<item name="colorAccent">@color/accent_color_dark</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/primary_text_color_selector_dark</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_dark</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_dark</item>
|
||||
|
||||
<item name="android:textColorLink">@color/link_color_dark</item>
|
||||
|
||||
<!-- Menu text color -->
|
||||
<item name="android:actionMenuTextColor">#FFFFFFFF</item>
|
||||
|
||||
<!-- default background color -->
|
||||
<item name="android:colorBackground">@color/riot_primary_background_color_dark</item>
|
||||
<item name="vctr_bottom_nav_background_color">@color/primary_color_dark</item>
|
||||
|
||||
<!-- waiting view background -->
|
||||
<item name="vctr_waiting_background_color">#55555555</item>
|
||||
|
||||
|
||||
<!-- application bar text color -->
|
||||
<item name="vctr_toolbar_primary_text_color">@color/riot_primary_text_color_dark</item>
|
||||
<item name="vctr_toolbar_secondary_text_color">@color/riot_secondary_text_color_dark</item>
|
||||
<item name="vctr_toolbar_link_text_color">@color/link_color_dark</item>
|
||||
|
||||
<!-- application bar text hint color -->
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_dark</item>
|
||||
|
||||
<item name="vctr_tab_home">@color/primary_color_dark</item>
|
||||
<item name="vctr_tab_home_secondary">@color/primary_color_dark_dark</item>
|
||||
|
||||
<!-- default text colors -->
|
||||
<item name="vctr_default_text_hint_color">@color/default_text_hint_color_dark</item>
|
||||
|
||||
<!-- room message colors -->
|
||||
<!--Unread Room Indent-->
|
||||
<item name="vctr_unread_room_indent_color">#FF2E3648</item>
|
||||
<item name="vctr_notice_secondary">#61708B</item>
|
||||
<item name="vctr_unsent_message_text_color">@color/vector_fuchsia_color</item>
|
||||
<item name="vctr_message_text_color">@android:color/white</item>
|
||||
<item name="vctr_notice_text_color">@color/riot_primary_text_color_dark</item>
|
||||
<item name="vctr_encrypting_message_text_color">@color/accent_color_dark</item>
|
||||
<item name="vctr_sending_message_text_color">?android:textColorSecondary</item>
|
||||
<item name="vctr_highlighted_message_text_color">@color/vector_fuchsia_color</item>
|
||||
<item name="vctr_highlighted_searched_message_text_color">@color/primary_color_light</item>
|
||||
<item name="vctr_search_mode_room_name_text_color">#CCC3C3C3</item>
|
||||
<item name="vctr_unread_marker_line_color">@color/accent_color_dark</item>
|
||||
<item name="vctr_markdown_block_background_color">@android:color/black</item>
|
||||
<item name="vctr_room_activity_divider_color">#565656</item>
|
||||
|
||||
<!-- tab bar colors -->
|
||||
<item name="vctr_tab_bar_inverted_background_color">?colorPrimary</item>
|
||||
<item name="vctr_tab_bar_selected_background_color">
|
||||
@color/tab_bar_selected_background_color_dark
|
||||
</item>
|
||||
<item name="vctr_tab_bar_unselected_background_color">
|
||||
@color/tab_bar_unselected_background_color_dark
|
||||
</item>
|
||||
|
||||
<!-- list colors -->
|
||||
<!--Header/Panel Background-->
|
||||
<item name="vctr_list_header_background_color">@color/primary_color_dark</item>
|
||||
<!--Header/Panel Text Primary-->
|
||||
<item name="vctr_list_header_primary_text_color">#FFA1B2D1</item>
|
||||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_list_header_secondary_text_color">#FFC8C8CD</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_dark</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80000000</item>
|
||||
|
||||
<!-- outgoing call background color -->
|
||||
<item name="vctr_pending_outgoing_view_background_color">#33FFFFFF</item>
|
||||
|
||||
<!-- multi selection member background color -->
|
||||
<item name="vctr_multi_selection_background_color">#4d4d4d</item>
|
||||
|
||||
<!-- sliding menu icon colors -->
|
||||
<item name="vctr_home_navigation_icon_color">@color/riot_primary_text_color_dark</item>
|
||||
|
||||
<!-- room notification text color (typing, unsent...) -->
|
||||
<!--Notice (secondary)-->
|
||||
<item name="vctr_room_notification_text_color">#FF61708b</item>
|
||||
|
||||
<!-- color for dividers in settings -->
|
||||
<item name="vctr_preference_divider_color">@color/list_divider_color_dark</item>
|
||||
|
||||
<!-- icon colors -->
|
||||
<item name="vctr_settings_icon_tint_color">@android:color/white</item>
|
||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||
|
||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||
<!-- dedicated drawables are created for each theme -->
|
||||
<item name="vctr_line_divider">@drawable/line_divider_dark</item>
|
||||
<item name="vctr_shadow_bottom">@drawable/shadow_bottom_dark</item>
|
||||
<item name="vctr_shadow_top">@drawable/shadow_top_dark</item>
|
||||
<item name="vctr_tabbar_selected_background">
|
||||
@drawable/vector_tabbar_selected_background_dark
|
||||
</item>
|
||||
<item name="vctr_tabbar_unselected_background">
|
||||
@drawable/vector_tabbar_unselected_background_dark
|
||||
</item>
|
||||
<item name="vctr_tabbar_background">@drawable/vector_tabbar_background_dark</item>
|
||||
|
||||
<item name="vctr_pill_background_user_id">@drawable/pill_background_user_id_dark</item>
|
||||
<item name="vctr_pill_background_room_alias">@drawable/pill_background_room_alias_dark</item>
|
||||
|
||||
<item name="vctr_pill_text_color_user_id">@android:color/white</item>
|
||||
<item name="vctr_pill_text_color_room_alias">@color/riot_primary_text_color_dark</item>
|
||||
|
||||
<item name="vctr_direct_chat_circle">@drawable/direct_chat_circle_dark</item>
|
||||
|
||||
<item name="vctr_widget_banner_background">#FF454545</item>
|
||||
|
||||
<!-- ANDROID SUPPORT ATTRIBUTES -->
|
||||
<!-- disable the overscroll because setOverscrollHeader/Footer don't always work -->
|
||||
<item name="android:overScrollMode">never</item>
|
||||
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@color/riot_primary_background_color_dark</item>
|
||||
|
||||
<!-- fonts -->
|
||||
<item name="android:typeface">sans</item>
|
||||
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/Vector.ActionBarTheme</item>
|
||||
|
||||
<!-- remove the shadow under the actionbar -->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<item name="android:popupMenuStyle">@style/Vector.PopupMenu</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- tabbar background -->
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Dark</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Dark</item>
|
||||
|
||||
<!-- tabbar text color -->
|
||||
<item name="android:actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
<item name="actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
|
||||
<!-- Preference -->
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/Vector.BottomSheet.Dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark" parent="AppTheme.Base.Dark" />
|
||||
|
||||
<style name="Theme.Vector.Lock.Dark" parent="Theme.AppCompat.Dialog">
|
||||
<item name="colorPrimary">@color/primary_color_dark</item>
|
||||
<item name="colorAccent">@color/accent_color_dark</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_dark</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_dark</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_dark</item>
|
||||
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_dark</item>
|
||||
<item name="vctr_message_text_color">?android:attr/textColorPrimary</item>
|
||||
|
||||
<item name="android:background">@color/riot_primary_background_color_dark</item>
|
||||
<item name="android:textColor">@color/riot_tertiary_text_color_dark</item>
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.TabView.Dark" parent="Widget.AppCompat.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/vector_tabbar_background_dark</item>
|
||||
<item name="background">@drawable/vector_tabbar_background_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- home activity -->
|
||||
<style name="HomeActivityTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textColorHint">?attr/vctr_default_text_hint_color</item>
|
||||
</style>
|
||||
|
||||
<!-- call activity -->
|
||||
<style name="CallActivityTheme.Dark" parent="AppTheme.Dark">
|
||||
<!-- status bar color -->
|
||||
<item name="colorPrimaryDark">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<!-- NoActionBar + FullScreen -->
|
||||
<style name="AppTheme.NoActionBar.FullScreen.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Picker activities -->
|
||||
<style name="CountryPickerTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="editTextColor">@android:color/white</item>
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">?attr/vctr_activity_bottom_gradient_color</item>
|
||||
</style>
|
||||
|
||||
<!-- searches activity -->
|
||||
<style name="SearchesAppTheme.Dark" parent="AppTheme.Dark">
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- edit text -->
|
||||
<item name="android:editTextStyle">@style/VectorSearches.EditText</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/VectorSearches.ActionBarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="CallAppTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:colorBackground">@color/primary_color_dark</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowTitleStyle">@style/RtlOverlay.DialogWindowTitle.AppCompat</item>
|
||||
<item name="android:windowTitleBackgroundStyle">
|
||||
@style/Base.DialogWindowTitleBackground.AppCompat
|
||||
</item>
|
||||
<item name="android:windowBackground">@drawable/abc_dialog_material_background</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="listPreferredItemPaddingLeft">24dip</item>
|
||||
<item name="listPreferredItemPaddingRight">24dip</item>
|
||||
|
||||
<item name="android:listDivider">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="GroupAppTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="colorPrimaryDark">@color/tab_groups_secondary</item>
|
||||
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
266
app/src/main/res/values/theme_light.xml
Normal file
266
app/src/main/res/values/theme_light.xml
Normal file
|
@ -0,0 +1,266 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- LIGHT THEME COLORS -->
|
||||
|
||||
<style name="AppTheme.Base.Light" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimaryDark">@color/primary_color_dark_light</item>
|
||||
<item name="colorPrimary">@color/primary_color_light</item>
|
||||
<item name="colorAccent">@color/accent_color_light</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/primary_text_color_selector_light</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_light</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_light</item>
|
||||
|
||||
<item name="android:textColorLink">@color/link_color_light</item>
|
||||
|
||||
<!-- Menu text color -->
|
||||
<item name="android:actionMenuTextColor">#FFFFFFFF</item>
|
||||
|
||||
<!-- default background color -->
|
||||
<item name="android:colorBackground">@color/riot_primary_background_color_light</item>
|
||||
<item name="vctr_bottom_nav_background_color">#FFF3F8FD</item>
|
||||
|
||||
<!-- waiting view background -->
|
||||
<item name="vctr_waiting_background_color">#AAAAAAAA</item>
|
||||
|
||||
<!-- application bar text color -->
|
||||
<!-- Base Text Primary-->
|
||||
<item name="vctr_toolbar_primary_text_color">#FFFFFFFF</item>
|
||||
<!-- Base Text Secondary-->
|
||||
<item name="vctr_toolbar_secondary_text_color">#FFFFFFFF</item>
|
||||
<item name="vctr_toolbar_link_text_color">@color/link_color_light</item>
|
||||
|
||||
<!-- application bar text hint color -->
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_light</item>
|
||||
|
||||
<item name="vctr_tab_home">@color/primary_color_light</item>
|
||||
<item name="vctr_tab_home_secondary">@color/primary_color_dark_light</item>
|
||||
|
||||
<!-- default text colors -->
|
||||
<item name="vctr_default_text_hint_color">@color/default_text_hint_color_light</item>
|
||||
|
||||
<!-- room message colors -->
|
||||
<!-- Notice (Secondary) -->
|
||||
<item name="vctr_unread_room_indent_color">#FF2E3648</item>
|
||||
<item name="vctr_notice_secondary">#61708B</item>
|
||||
<item name="vctr_unsent_message_text_color">@color/vector_fuchsia_color</item>
|
||||
<item name="vctr_message_text_color">@color/riot_primary_text_color_light</item>
|
||||
<item name="vctr_notice_text_color">#FF61708b</item>
|
||||
<item name="vctr_encrypting_message_text_color">@color/accent_color_light</item>
|
||||
<item name="vctr_sending_message_text_color">?android:textColorSecondary</item>
|
||||
<item name="vctr_highlighted_message_text_color">@color/vector_fuchsia_color</item>
|
||||
<item name="vctr_highlighted_searched_message_text_color">@color/primary_color_light</item>
|
||||
<item name="vctr_search_mode_room_name_text_color">#333C3C3C</item>
|
||||
<item name="vctr_unread_marker_line_color">@color/accent_color_light</item>
|
||||
<item name="vctr_markdown_block_background_color">#FFEEEEEE</item>
|
||||
<item name="vctr_room_activity_divider_color">#FFF2F2F2</item>
|
||||
|
||||
<!-- tab bar colors -->
|
||||
<item name="vctr_tab_bar_inverted_background_color">#FFF2F2F2</item>
|
||||
<item name="vctr_tab_bar_selected_background_color">
|
||||
@color/tab_bar_selected_background_color_light
|
||||
</item>
|
||||
<item name="vctr_tab_bar_unselected_background_color">
|
||||
@color/tab_bar_unselected_background_color_light
|
||||
</item>
|
||||
|
||||
<!-- list colors -->
|
||||
<!--Header/Panel Background-->
|
||||
<item name="vctr_list_header_background_color">#FFF3F8FD</item>
|
||||
<!--Header/Panel Text Primary-->
|
||||
<item name="vctr_list_header_primary_text_color">#FF61708B</item>
|
||||
<!--Header/Panel Text Secondary-->
|
||||
<item name="vctr_list_header_secondary_text_color">#FFC8C8CD</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_light</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80ffffff</item>
|
||||
|
||||
<!-- outgoing call background color -->
|
||||
<item name="vctr_pending_outgoing_view_background_color">#33000000</item>
|
||||
|
||||
<!-- multi selection member background color -->
|
||||
<item name="vctr_multi_selection_background_color">#FFF2F2F2</item>
|
||||
|
||||
<!-- sliding menu icon colors -->
|
||||
<item name="vctr_home_navigation_icon_color">@color/riot_primary_text_color_light</item>
|
||||
|
||||
<!-- room notification text color (typing, unsent...) -->
|
||||
<!--Notice (secondary)-->
|
||||
<item name="vctr_room_notification_text_color">#FF61708b</item>
|
||||
|
||||
<!-- color for dividers in settings -->
|
||||
<item name="vctr_preference_divider_color">@color/list_divider_color_light</item>
|
||||
|
||||
<!-- icon colors -->
|
||||
<item name="vctr_settings_icon_tint_color">@android:color/black</item>
|
||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||
|
||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||
<!-- dedicated drawables are created for each theme -->
|
||||
<item name="vctr_line_divider">@drawable/line_divider_light</item>
|
||||
<item name="vctr_shadow_bottom">@drawable/shadow_bottom_light</item>
|
||||
<item name="vctr_shadow_top">@drawable/shadow_top_light</item>
|
||||
<item name="vctr_tabbar_selected_background">
|
||||
@drawable/vector_tabbar_selected_background_light
|
||||
</item>
|
||||
<item name="vctr_tabbar_unselected_background">
|
||||
@drawable/vector_tabbar_unselected_background_light
|
||||
</item>
|
||||
<item name="vctr_tabbar_background">@drawable/vector_tabbar_background_light</item>
|
||||
|
||||
<item name="vctr_pill_background_user_id">@drawable/pill_background_user_id_light</item>
|
||||
<item name="vctr_pill_background_room_alias">@drawable/pill_background_room_alias_light</item>
|
||||
|
||||
<item name="vctr_pill_text_color_user_id">@color/riot_primary_text_color_light</item>
|
||||
<item name="vctr_pill_text_color_room_alias">@android:color/white</item>
|
||||
|
||||
<item name="vctr_direct_chat_circle">@drawable/direct_chat_circle_light</item>
|
||||
|
||||
<item name="vctr_widget_banner_background">#FFD3EFE1</item>
|
||||
|
||||
<!-- ANDROID SUPPORT ATTRIBUTES -->
|
||||
<!-- disable the overscroll because setOverscrollHeader/Footer don't always work -->
|
||||
<item name="android:overScrollMode">never</item>
|
||||
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@color/riot_primary_background_color_light</item>
|
||||
|
||||
<!-- fonts -->
|
||||
<item name="android:typeface">sans</item>
|
||||
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/Vector.ActionBarTheme</item>
|
||||
|
||||
<!-- remove the shadow under the actionbar -->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<item name="android:popupMenuStyle">@style/Vector.PopupMenu</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- tabbar background -->
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Light</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Light</item>
|
||||
|
||||
<!-- tabbar text color -->
|
||||
<item name="android:actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
<item name="actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
|
||||
<!-- Preference -->
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/Vector.BottomSheet.Light</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light" parent="AppTheme.Base.Light" />
|
||||
|
||||
<style name="Theme.Vector.Lock.Light" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorPrimary">@color/primary_color_light</item>
|
||||
<item name="colorAccent">@color/accent_color_light</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_light</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_light</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_light</item>
|
||||
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_light</item>
|
||||
<item name="vctr_message_text_color">?android:attr/textColorPrimary</item>
|
||||
|
||||
<item name="android:background">@color/riot_primary_background_color_light</item>
|
||||
<item name="android:textColor">@color/riot_tertiary_text_color_light</item>
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.TabView.Light" parent="Widget.AppCompat.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/vector_tabbar_background_light</item>
|
||||
<item name="background">@drawable/vector_tabbar_background_light</item>
|
||||
</style>
|
||||
|
||||
<!-- home activity -->
|
||||
<style name="HomeActivityTheme.Light" parent="AppTheme.Light">
|
||||
<item name="editTextColor">@android:color/white</item>
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">?attr/vctr_activity_bottom_gradient_color</item>
|
||||
</style>
|
||||
|
||||
<!-- call activity -->
|
||||
<style name="CallActivityTheme.Light" parent="AppTheme.Light">
|
||||
<!-- status bar color -->
|
||||
<item name="colorPrimaryDark">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<!-- NoActionBar + FullScreen -->
|
||||
<style name="AppTheme.NoActionBar.FullScreen.Light" parent="AppTheme.Light">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Picker activities -->
|
||||
<style name="CountryPickerTheme.Light" parent="AppTheme.Light">
|
||||
<item name="editTextColor">@android:color/white</item>
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">?attr/vctr_activity_bottom_gradient_color</item>
|
||||
</style>
|
||||
|
||||
<!-- searches activity -->
|
||||
<style name="SearchesAppTheme.Light" parent="AppTheme.Light">
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- edit text -->
|
||||
<item name="android:editTextStyle">@style/VectorSearches.EditText</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/VectorSearches.ActionBarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="CallAppTheme.Light" parent="AppTheme.Light">
|
||||
<item name="android:colorBackground">?attr/colorBackgroundFloating</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowTitleStyle">@style/RtlOverlay.DialogWindowTitle.AppCompat</item>
|
||||
<item name="android:windowTitleBackgroundStyle">
|
||||
@style/Base.DialogWindowTitleBackground.AppCompat
|
||||
</item>
|
||||
<item name="android:windowBackground">@drawable/abc_dialog_material_background</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="listPreferredItemPaddingLeft">24dip</item>
|
||||
<item name="listPreferredItemPaddingRight">24dip</item>
|
||||
|
||||
<item name="android:listDivider">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="GroupAppTheme.Light" parent="AppTheme.Light">
|
||||
<item name="colorPrimaryDark">@color/tab_groups_secondary</item>
|
||||
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dialog.Light" parent="Theme.AppCompat.Light.Dialog.Alert" />
|
||||
|
||||
</resources>
|
260
app/src/main/res/values/theme_status.xml
Normal file
260
app/src/main/res/values/theme_status.xml
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- STATUS.IM THEME COLORS -->
|
||||
|
||||
<style name="AppTheme.Base.Status" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimaryDark">@color/primary_color_dark_status</item>
|
||||
<item name="colorPrimary">@color/primary_color_status</item>
|
||||
<item name="colorAccent">@color/accent_color_status</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/primary_text_color_selector_status</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_status</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_status</item>
|
||||
|
||||
<item name="android:textColorLink">@color/link_color_status</item>
|
||||
|
||||
|
||||
<!-- Menu text color -->
|
||||
<item name="android:actionMenuTextColor">#FFFFFFFF</item>
|
||||
|
||||
<!-- default background color -->
|
||||
<item name="android:colorBackground">@color/riot_primary_background_color_status</item>
|
||||
<item name="vctr_bottom_nav_background_color">@color/riot_primary_background_color_status</item>
|
||||
|
||||
<!-- waiting view background -->
|
||||
<item name="vctr_waiting_background_color">#AAAAAAAA</item>
|
||||
|
||||
<!-- application bar text color -->
|
||||
<item name="vctr_toolbar_primary_text_color">#FFFFFFFF</item>
|
||||
<item name="vctr_toolbar_secondary_text_color">#FFD8D8D8</item>
|
||||
<item name="vctr_toolbar_link_text_color">#FFD8D8D8</item>
|
||||
|
||||
<!-- application bar text hint color -->
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_light</item>
|
||||
|
||||
<item name="vctr_tab_home">@color/primary_color_status</item>
|
||||
<item name="vctr_tab_home_secondary">@color/primary_color_dark_status</item>
|
||||
|
||||
<!-- default text colors -->
|
||||
<item name="vctr_default_text_hint_color">@color/default_text_hint_color_light</item>
|
||||
|
||||
<!-- room message colors -->
|
||||
<item name="vctr_unread_room_indent_color">?colorAccent</item>
|
||||
<item name="vctr_notice_secondary">#61708B</item>
|
||||
<item name="vctr_unsent_message_text_color">#FFFF4444</item>
|
||||
<item name="vctr_message_text_color">#70879d</item>
|
||||
<item name="vctr_notice_text_color">#adadbe</item>
|
||||
<item name="vctr_encrypting_message_text_color">#AECDF9</item>
|
||||
<item name="vctr_sending_message_text_color">#b3e8d2</item>
|
||||
<item name="vctr_highlighted_message_text_color">@color/vector_fuchsia_color</item>
|
||||
<item name="vctr_highlighted_searched_message_text_color">@color/primary_color_status</item>
|
||||
<item name="vctr_search_mode_room_name_text_color">#333C3C3C</item>
|
||||
<item name="vctr_unread_marker_line_color">#AECDF9</item>
|
||||
<item name="vctr_markdown_block_background_color">#FFEEEEEE</item>
|
||||
<item name="vctr_room_activity_divider_color">#FFF2F2F2</item>
|
||||
|
||||
<!-- tab bar colors -->
|
||||
<item name="vctr_tab_bar_inverted_background_color">#FFF2F2F2</item>
|
||||
<item name="vctr_tab_bar_selected_background_color">
|
||||
@color/tab_bar_selected_background_color_status
|
||||
</item>
|
||||
<item name="vctr_tab_bar_unselected_background_color">
|
||||
@color/tab_bar_unselected_background_color_status
|
||||
</item>
|
||||
|
||||
<!-- list colors -->
|
||||
<item name="vctr_list_header_background_color">#FFF6F6F6</item>
|
||||
<item name="vctr_list_header_primary_text_color">#7F3C3C3C</item>
|
||||
<item name="vctr_list_header_secondary_text_color">#4D3C3C3C</item>
|
||||
|
||||
<item name="vctr_list_divider_color">@color/list_divider_color_light</item>
|
||||
|
||||
<!-- gradient on the home bottom -->
|
||||
<item name="vctr_activity_bottom_gradient_color">#80ffffff</item>
|
||||
|
||||
<!-- outgoing call background color -->
|
||||
<item name="vctr_pending_outgoing_view_background_color">#33000000</item>
|
||||
|
||||
<!-- multi selection member background color -->
|
||||
<item name="vctr_multi_selection_background_color">#FFF2F2F2</item>
|
||||
|
||||
<!-- sliding menu icon colors -->
|
||||
<item name="vctr_home_navigation_icon_color">@color/riot_primary_text_color_status</item>
|
||||
|
||||
<!-- room notification text color (typing, unsent...) -->
|
||||
<item name="vctr_room_notification_text_color">#a0a29f</item>
|
||||
|
||||
<!-- color for dividers in settings -->
|
||||
<item name="vctr_preference_divider_color">#e1e1e1</item>
|
||||
|
||||
<!-- icon colors -->
|
||||
<item name="vctr_settings_icon_tint_color">@color/accent_color_status</item>
|
||||
<item name="vctr_icon_tint_on_light_action_bar_color">@android:color/white</item>
|
||||
<item name="vctr_icon_tint_on_dark_action_bar_color">@android:color/white</item>
|
||||
|
||||
<!-- theses colours are requested a background cannot be set by an ?att on android < 5 -->
|
||||
<!-- dedicated drawables are created for each theme -->
|
||||
<item name="vctr_line_divider">@drawable/line_divider_light</item>
|
||||
<item name="vctr_shadow_bottom">@drawable/shadow_bottom_light</item>
|
||||
<item name="vctr_shadow_top">@drawable/shadow_top_light</item>
|
||||
<item name="vctr_tabbar_selected_background">
|
||||
@drawable/vector_tabbar_selected_background_status
|
||||
</item>
|
||||
<item name="vctr_tabbar_unselected_background">
|
||||
@drawable/vector_tabbar_unselected_background_status
|
||||
</item>
|
||||
<item name="vctr_tabbar_background">@drawable/vector_tabbar_background_status</item>
|
||||
|
||||
<item name="vctr_pill_background_user_id">@drawable/pill_background_user_id_status</item>
|
||||
<item name="vctr_pill_background_room_alias">@drawable/pill_background_room_alias_status</item>
|
||||
|
||||
<item name="vctr_pill_text_color_user_id">@color/riot_primary_text_color_status</item>
|
||||
<item name="vctr_pill_text_color_room_alias">@android:color/white</item>
|
||||
|
||||
<item name="vctr_direct_chat_circle">@drawable/direct_chat_circle_status</item>
|
||||
|
||||
<item name="vctr_widget_banner_background">#FFF7F7F7</item>
|
||||
|
||||
<!-- ANDROID SUPPORT ATTRIBUTES -->
|
||||
<!-- disable the overscroll because setOverscrollHeader/Footer don't always work -->
|
||||
<item name="android:overScrollMode">never</item>
|
||||
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@color/riot_primary_background_color_status</item>
|
||||
|
||||
<!-- fonts -->
|
||||
<item name="android:typeface">sans</item>
|
||||
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/Vector.Styled.ActionBar</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/Vector.ActionBarTheme</item>
|
||||
|
||||
<!-- remove the shadow under the actionbar -->
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
|
||||
<item name="android:popupMenuStyle">@style/Vector.PopupMenu</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- tabbar background -->
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Status</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Status</item>
|
||||
|
||||
<!-- tabbar text color -->
|
||||
<item name="android:actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
<item name="actionBarTabTextStyle">@style/Vector.TabText</item>
|
||||
|
||||
<!-- Preference -->
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
|
||||
<item name="bottomSheetDialogTheme">@style/Vector.BottomSheet.Status</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Status" parent="AppTheme.Base.Status" />
|
||||
|
||||
<style name="Theme.Vector.Lock.Status" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="colorPrimary">@color/primary_color_status</item>
|
||||
<item name="colorAccent">@color/accent_color_status</item>
|
||||
|
||||
<item name="android:textColorPrimary">@color/riot_primary_text_color_status</item>
|
||||
<item name="android:textColorSecondary">@color/riot_secondary_text_color_status</item>
|
||||
<!-- Default color for text View -->
|
||||
<item name="android:textColorTertiary">@color/riot_tertiary_text_color_status</item>
|
||||
|
||||
<item name="vctr_primary_hint_text_color">@color/primary_hint_text_color_light</item>
|
||||
<item name="vctr_message_text_color">?android:attr/textColorPrimary</item>
|
||||
|
||||
<item name="android:background">@color/riot_primary_background_color_status</item>
|
||||
<item name="android:textColor">@color/riot_tertiary_text_color_status</item>
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Vector.TabView.Status" parent="Widget.AppCompat.ActionBar.TabView">
|
||||
<item name="android:background">@drawable/vector_tabbar_background_status</item>
|
||||
<item name="background">@drawable/vector_tabbar_background_status</item>
|
||||
</style>
|
||||
|
||||
<!-- home activity -->
|
||||
<style name="HomeActivityTheme.Status" parent="AppTheme.Status">
|
||||
<item name="editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:editTextColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textColorHint">?attr/vctr_default_text_hint_color</item>
|
||||
</style>
|
||||
|
||||
<!-- call activity -->
|
||||
<style name="CallActivityTheme.Status" parent="AppTheme.Status">
|
||||
<!-- status bar color -->
|
||||
<item name="colorPrimaryDark">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<!-- NoActionBar + FullScreen -->
|
||||
<style name="AppTheme.NoActionBar.FullScreen.Status" parent="AppTheme.Status">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<!-- activities background -->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Picker activities -->
|
||||
<style name="CountryPickerTheme.Status" parent="AppTheme.Status">
|
||||
<item name="editTextColor">@android:color/white</item>
|
||||
<item name="android:editTextColor">@android:color/white</item>
|
||||
<item name="android:textColorHint">?attr/vctr_activity_bottom_gradient_color</item>
|
||||
</style>
|
||||
|
||||
<!-- searches activity -->
|
||||
<style name="SearchesAppTheme.Status" parent="AppTheme.Status">
|
||||
<!-- custom action bar -->
|
||||
<item name="android:actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
<item name="actionBarStyle">@style/VectorSearches.Styled.ActionBar</item>
|
||||
|
||||
<!-- no divider -->
|
||||
<item name="android:actionBarDivider">@null</item>
|
||||
|
||||
<!-- edit text -->
|
||||
<item name="android:editTextStyle">@style/VectorSearches.EditText</item>
|
||||
|
||||
<!-- actionbar icons color -->
|
||||
<item name="actionBarTheme">@style/VectorSearches.ActionBarTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="CallAppTheme.Status" parent="AppTheme.Status">
|
||||
<item name="android:colorBackground">?attr/colorBackgroundFloating</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowTitleStyle">@style/RtlOverlay.DialogWindowTitle.AppCompat</item>
|
||||
<item name="android:windowTitleBackgroundStyle">
|
||||
@style/Base.DialogWindowTitleBackground.AppCompat
|
||||
</item>
|
||||
<item name="android:windowBackground">@drawable/abc_dialog_material_background</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
|
||||
<item name="listPreferredItemPaddingLeft">24dip</item>
|
||||
<item name="listPreferredItemPaddingRight">24dip</item>
|
||||
|
||||
<item name="android:listDivider">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="GroupAppTheme.Status" parent="AppTheme.Status">
|
||||
<item name="colorPrimaryDark">@color/tab_groups_secondary</item>
|
||||
|
||||
<item name="android:actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
<item name="actionBarTabStyle">@style/Vector.TabView.Group</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dialog.Status" parent="Theme.AppCompat.Light.Dialog.Alert" />
|
||||
|
||||
</resources>
|
Loading…
Reference in a new issue