Multiple changes
@ -46,7 +46,6 @@ dependencies {
|
||||
transitive = true;
|
||||
}
|
||||
compile 'com.android.support:design:26.1.0'
|
||||
compile 'com.github.rubensousa:bottomsheetbuilder:1.6.0'
|
||||
compile 'com.github.johnhiott:DarkSkyApi:v0.1.5'
|
||||
compile 'org.greenrobot:eventbus:3.0.0'
|
||||
compile 'com.android.support:recyclerview-v7:26.1.0'
|
||||
}
|
||||
|
@ -66,6 +66,7 @@
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="com.tommasoberlose.anotherwidget.action.ACTION_WEATHER_UPDATE" />
|
||||
<action android:name="android.location.PROVIDERS_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
@ -78,7 +79,12 @@
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:launchMode="singleInstance"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".ui.activity.ChooseApplicationActivity"></activity>
|
||||
<activity android:name=".ui.activity.ChooseApplicationActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".ui.activity.WeatherProviderActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -14,6 +14,7 @@ object Constants {
|
||||
val LOCATION_REQUEST_CODE = 2
|
||||
val CALENDAR_APP_REQUEST_CODE = 3
|
||||
val WEATHER_APP_REQUEST_CODE = 4
|
||||
val WEATHER_PROVIDER_REQUEST_CODE = 5
|
||||
|
||||
|
||||
val RESULT_CODE_CUSTOM_LOCATION = 45
|
||||
@ -45,6 +46,7 @@ object Constants {
|
||||
val PREF_CALENDAR_APP_PACKAGE = "PREF_CALENDAR_APP_PACKAGE"
|
||||
val PREF_WEATHER_APP_NAME = "PREF_WEATHER_APP_NAME"
|
||||
val PREF_WEATHER_APP_PACKAGE = "PREF_WEATHER_APP_PACKAGE"
|
||||
val PREF_WEATHER_PROVIDER_API_KEY = "PREF_WEATHER_PROVIDER_API_KEY"
|
||||
|
||||
val itDateFormat = SimpleDateFormat("EEEE, d MMM")
|
||||
val engDateFormat = SimpleDateFormat("EEEE, MMM d")
|
||||
|
@ -18,7 +18,7 @@ class WeatherReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action.equals(Intent.ACTION_BOOT_COMPLETED) || intent.action.equals(Intent.ACTION_MY_PACKAGE_REPLACED)) {
|
||||
setUpdates(context)
|
||||
} else if (intent.action.equals(Constants.ACTION_WEATHER_UPDATE)) {
|
||||
} else if (intent.action.equals(Constants.ACTION_WEATHER_UPDATE) || intent.action.equals("android.location.PROVIDERS_CHANGED")) {
|
||||
WeatherUtil.updateWeather(context)
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,15 @@ import android.widget.ArrayAdapter
|
||||
import com.tommasoberlose.anotherwidget.`object`.ApplicationListEvent
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.Geocoder
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.Log
|
||||
import com.tommasoberlose.anotherwidget.ui.adapter.ApplicationInfoAdapter
|
||||
|
||||
|
||||
class ChooseApplicationActivity : AppCompatActivity() {
|
||||
lateinit var adapter: ArrayAdapter<String>
|
||||
lateinit var adapter: ApplicationInfoAdapter
|
||||
val appList = ArrayList<ApplicationInfo>()
|
||||
val appListFiltered = ArrayList<ApplicationInfo>()
|
||||
|
||||
@ -38,16 +40,20 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
selectDefaultApp()
|
||||
}
|
||||
|
||||
adapter = ArrayAdapter(this, R.layout.custom_location_item, appList.map { it.name })
|
||||
list_view.adapter = adapter
|
||||
list_view.setHasFixedSize(true);
|
||||
val mLayoutManager = LinearLayoutManager(this);
|
||||
list_view.layoutManager = mLayoutManager;
|
||||
|
||||
list_view.onItemClickListener = AdapterView.OnItemClickListener { parent, view, position, id ->
|
||||
adapter = ApplicationInfoAdapter(this, appListFiltered);
|
||||
list_view.setAdapter(adapter);
|
||||
|
||||
/*list_view.onItemClickListener = AdapterView.OnItemClickListener { parent, view, position, id ->
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra(Constants.RESULT_APP_NAME, pm.getApplicationLabel(appListFiltered[position]).toString())
|
||||
resultIntent.putExtra(Constants.RESULT_APP_PACKAGE, appListFiltered[position].packageName)
|
||||
setResult(Activity.RESULT_OK, resultIntent)
|
||||
finish()
|
||||
}
|
||||
}*/
|
||||
|
||||
location.addTextChangedListener(object: TextWatcher {
|
||||
override fun afterTextChanged(text: Editable?) {
|
||||
@ -95,20 +101,12 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
fun onMessageEvent(event: ApplicationListEvent) {
|
||||
val pm = packageManager
|
||||
adapter.clear()
|
||||
if (!event.filtered) {
|
||||
appList.clear()
|
||||
event.apps.mapTo(appList, {it})
|
||||
for (a:ApplicationInfo in appList) {
|
||||
adapter.add(pm.getApplicationLabel(a).toString())
|
||||
}
|
||||
}
|
||||
appListFiltered.clear()
|
||||
event.apps.mapTo(appListFiltered, {it})
|
||||
for (a:ApplicationInfo in appListFiltered) {
|
||||
adapter.add(pm.getApplicationLabel(a).toString())
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
adapter.changeData(appListFiltered)
|
||||
}
|
||||
}
|
||||
|
@ -24,12 +24,14 @@ import com.tommasoberlose.anotherwidget.util.CalendarUtil
|
||||
import com.tommasoberlose.anotherwidget.util.WeatherUtil
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.support.design.widget.BottomSheetDialog
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import com.crashlytics.android.Crashlytics
|
||||
import com.tommasoberlose.anotherwidget.`object`.CalendarSelector
|
||||
import io.fabric.sdk.android.Fabric
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.main_menu_layout.view.*
|
||||
import kotlinx.android.synthetic.main.the_widget.*
|
||||
|
||||
|
||||
@ -55,10 +57,6 @@ class MainActivity : AppCompatActivity() {
|
||||
AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
|
||||
if (mAppWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||
|
||||
action_refresh.visibility = View.GONE
|
||||
action_support.visibility = View.GONE
|
||||
action_share.visibility = View.GONE
|
||||
action_add_widget.visibility = View.VISIBLE
|
||||
|
||||
action_add_widget.setOnClickListener {
|
||||
@ -67,22 +65,47 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
action_support.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.openURI(this@MainActivity, "https://paypal.me/tommasoberlose")
|
||||
}
|
||||
})
|
||||
|
||||
action_share.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.share(this@MainActivity)
|
||||
}
|
||||
})
|
||||
|
||||
action_refresh.setOnClickListener {
|
||||
WeatherUtil.updateWeather(this)
|
||||
CalendarUtil.updateEventList(this)
|
||||
Util.updateWidget(this)
|
||||
action_menu.setOnClickListener {
|
||||
val mBottomSheetDialog: BottomSheetDialog = BottomSheetDialog(this)
|
||||
val menuView: View = getLayoutInflater().inflate(R.layout.main_menu_layout, null)
|
||||
menuView.action_support.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.openURI(this@MainActivity, "https://paypal.me/tommasoberlose")
|
||||
mBottomSheetDialog.dismiss()
|
||||
}
|
||||
})
|
||||
|
||||
menuView.action_share.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.share(this@MainActivity)
|
||||
mBottomSheetDialog.dismiss()
|
||||
}
|
||||
})
|
||||
|
||||
menuView.action_rate.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.rateApp(this@MainActivity, "https://play.google.com/store/apps/details?id=com.tommasoberlose.anotherwidget")
|
||||
mBottomSheetDialog.dismiss()
|
||||
}
|
||||
})
|
||||
|
||||
menuView.action_feedback.setOnClickListener(object: View.OnClickListener {
|
||||
override fun onClick(p0: View?) {
|
||||
Util.sendEmail(this@MainActivity)
|
||||
mBottomSheetDialog.dismiss()
|
||||
}
|
||||
})
|
||||
|
||||
menuView.action_refresh.setOnClickListener {
|
||||
WeatherUtil.updateWeather(this)
|
||||
CalendarUtil.updateEventList(this)
|
||||
Util.updateWidget(this)
|
||||
mBottomSheetDialog.dismiss()
|
||||
}
|
||||
mBottomSheetDialog.setContentView(menuView)
|
||||
mBottomSheetDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,8 +148,13 @@ class MainActivity : AppCompatActivity() {
|
||||
updateSettings()
|
||||
}
|
||||
Constants.LOCATION_REQUEST_CODE -> if (!(permissions.size != 1 || grantResults.size != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED)) {
|
||||
WeatherUtil.updateWeather(this)
|
||||
updateAppWidget()
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
if (SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) {
|
||||
startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE)
|
||||
} else {
|
||||
WeatherUtil.updateWeather(this)
|
||||
updateAppWidget()
|
||||
}
|
||||
updateSettings()
|
||||
}
|
||||
}
|
||||
@ -169,6 +197,9 @@ class MainActivity : AppCompatActivity() {
|
||||
Util.updateWidget(this)
|
||||
updateSettings()
|
||||
updateAppWidget()
|
||||
} else if (requestCode == Constants.WEATHER_PROVIDER_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||
sendBroadcast(Intent(Constants.ACTION_WEATHER_UPDATE))
|
||||
updateSettings()
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,9 +210,9 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
empty_layout.visibility = View.VISIBLE
|
||||
calendar_layout.visibility = View.GONE
|
||||
var dateStringValue: String = String.format("%s%s", Constants.engDateFormat.format(now.time)[0].toUpperCase(), Constants.engDateFormat.format(now.time).substring(1))
|
||||
var dateStringValue: String = Util.getCapWordString(Constants.engDateFormat.format(now.time))
|
||||
if (SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)) {
|
||||
dateStringValue = String.format("%s%s", Constants.itDateFormat.format(now.time)[0].toUpperCase(), Constants.itDateFormat.format(now.time).substring(1))
|
||||
dateStringValue = Util.getCapWordString(Constants.itDateFormat.format(now.time))
|
||||
}
|
||||
empty_date.text = dateStringValue
|
||||
//empty_date.setImageBitmap(Util.buildUpdate(this, String.format("%s%s", Constants.dateFormat.format(now.time)[0].toUpperCase(), Constants.dateFormat.format(now.time).substring(1)), "fonts/product_sans_regular.ttf"))
|
||||
@ -241,7 +272,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
fun updateLocationView() {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true) && Util.checkGrantedPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true)
|
||||
|
||||
if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) {
|
||||
weather.visibility = View.VISIBLE
|
||||
@ -408,6 +439,17 @@ class MainActivity : AppCompatActivity() {
|
||||
startActivityForResult(Intent(this, ChooseApplicationActivity::class.java), Constants.WEATHER_APP_REQUEST_CODE)
|
||||
}
|
||||
|
||||
if (!SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) {
|
||||
label_weather_provider_api_key.text = getString(R.string.settings_weather_provider_api_key_subtitle_all_set)
|
||||
alert_icon.visibility = View.GONE
|
||||
} else {
|
||||
label_weather_provider_api_key.text = getString(R.string.settings_weather_provider_api_key_subtitle_not_set)
|
||||
alert_icon.visibility = View.VISIBLE
|
||||
}
|
||||
action_weather_provider_api_key.setOnClickListener {
|
||||
startActivityForResult(Intent(this, WeatherProviderActivity::class.java), Constants.WEATHER_PROVIDER_REQUEST_CODE)
|
||||
}
|
||||
|
||||
action_filter_calendar.setOnClickListener {
|
||||
val calendarSelectorList: List<CalendarSelector> = CalendarUtil.getCalendarList(this)
|
||||
var calFiltered = SP.getString(Constants.PREF_CALENDAR_FILTER, "")
|
||||
|
@ -0,0 +1,71 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.View
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
import kotlinx.android.synthetic.main.activity_weather_provider.*
|
||||
|
||||
class WeatherProviderActivity : AppCompatActivity() {
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_weather_provider)
|
||||
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
action_paste.setOnClickListener {
|
||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
api_key.setText(clipboard.primaryClip.getItemAt(0).text)
|
||||
}
|
||||
|
||||
action_save.setOnClickListener {
|
||||
SP.edit()
|
||||
.putString(Constants.PREF_WEATHER_PROVIDER_API_KEY, api_key.text.toString())
|
||||
.commit()
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
|
||||
api_key.addTextChangedListener(object: TextWatcher {
|
||||
override fun afterTextChanged(text: Editable?) {
|
||||
if (text.toString().equals("") || text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
||||
action_save.animate().scaleY(-2f).start()
|
||||
} else {
|
||||
action_save.animate().scaleY(0f).start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
if (api_key.text.toString().equals("") || !api_key.text.toString().equals(SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, ""))) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(getString(R.string.error_weather_api_key))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(android.R.string.ok, DialogInterface.OnClickListener { _,_ ->
|
||||
super.onBackPressed()
|
||||
})
|
||||
.show()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Created by tommaso on 15/10/17.
|
||||
*/
|
||||
class ApplicationInfoAdapter (private val context: Context, private var mDataset: ArrayList<ApplicationInfo>) : RecyclerView.Adapter<ApplicationInfoAdapter.ViewHolder>() {
|
||||
|
||||
class ViewHolder(var view: View, var text: TextView, var icon: ImageView) : RecyclerView.ViewHolder(view)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.application_info_layout, parent, false)
|
||||
return ViewHolder(v, v.findViewById(R.id.text), v.findViewById(R.id.icon))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val pm = context.packageManager
|
||||
holder.text.text = pm.getApplicationLabel(mDataset[position]).toString()
|
||||
try {
|
||||
holder.icon.setImageDrawable(mDataset[position].loadIcon(pm))
|
||||
} catch (ignore: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mDataset.size
|
||||
}
|
||||
|
||||
fun changeData(newData: ArrayList<ApplicationInfo>) {
|
||||
mDataset = newData
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
@ -80,9 +80,9 @@ class TheWidget : AppWidgetProvider() {
|
||||
|
||||
views.setViewVisibility(R.id.empty_layout, View.VISIBLE)
|
||||
views.setViewVisibility(R.id.calendar_layout, View.GONE)
|
||||
var dateStringValue: String = String.format("%s%s", Constants.engDateFormat.format(now.time)[0].toUpperCase(), Constants.engDateFormat.format(now.time).substring(1))
|
||||
var dateStringValue: String = Util.getCapWordString(Constants.engDateFormat.format(now.time))
|
||||
if (SP.getBoolean(Constants.PREF_ITA_FORMAT_DATE, false)) {
|
||||
dateStringValue = String.format("%s%s", Constants.itDateFormat.format(now.time)[0].toUpperCase(), Constants.itDateFormat.format(now.time).substring(1))
|
||||
dateStringValue = Util.getCapWordString(Constants.itDateFormat.format(now.time))
|
||||
}
|
||||
views.setTextViewText(R.id.empty_date, dateStringValue)
|
||||
//views.setImageViewBitmap(R.id.empty_date, Util.buildUpdate(context, Constants.dateFormat.format(now.time)[0].toUpperCase() + Constants.dateFormat.format(now.time).substring(1), "fonts/product_sans_regular.ttf"))
|
||||
@ -158,7 +158,7 @@ class TheWidget : AppWidgetProvider() {
|
||||
|
||||
fun updateLocationView(context: Context, views: RemoteViews, widgetID: Int): RemoteViews {
|
||||
val SP = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true) && Util.checkGrantedPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
val locationLayout = SP.getBoolean(Constants.PREF_SHOW_WEATHER, true)
|
||||
|
||||
if (locationLayout && SP.contains(Constants.PREF_WEATHER_TEMP) && SP.contains(Constants.PREF_WEATHER_ICON)) {
|
||||
views.setViewVisibility(R.id.weather, View.VISIBLE)
|
||||
|
@ -22,74 +22,78 @@ object CalendarUtil {
|
||||
|
||||
fun updateEventList(context: Context) {
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val eventList = ArrayList<Event>()
|
||||
if (SP.getBoolean(Constants.PREF_SHOW_EVENTS, true)) {
|
||||
val eventList = ArrayList<Event>()
|
||||
|
||||
val now = Calendar.getInstance()
|
||||
val limit = Calendar.getInstance()
|
||||
when (SP.getInt(Constants.PREF_SHOW_UNTIL, 1)) {
|
||||
0 -> limit.add(Calendar.HOUR, 3)
|
||||
1 -> limit.add(Calendar.HOUR, 6)
|
||||
2 -> limit.add(Calendar.HOUR, 12)
|
||||
3 -> limit.add(Calendar.DAY_OF_MONTH, 1)
|
||||
4 -> limit.add(Calendar.DAY_OF_MONTH, 3)
|
||||
5 -> limit.add(Calendar.DAY_OF_MONTH, 7)
|
||||
else -> limit.add(Calendar.HOUR, 6)
|
||||
}
|
||||
|
||||
|
||||
val builder = CalendarContract.Instances.CONTENT_URI.buildUpon()
|
||||
ContentUris.appendId(builder, now.timeInMillis)
|
||||
ContentUris.appendId(builder, limit.timeInMillis)
|
||||
|
||||
if (!Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)) {
|
||||
resetNextEventData(context)
|
||||
} else {
|
||||
|
||||
val instanceCursor = context.contentResolver.query(builder.build(), arrayOf(CalendarContract.Instances.EVENT_ID, CalendarContract.Instances.BEGIN, CalendarContract.Instances.END), null, null, null)
|
||||
if (instanceCursor != null && instanceCursor.count > 0) {
|
||||
instanceCursor.moveToFirst()
|
||||
|
||||
for (i in 0 until instanceCursor.count) {
|
||||
val ID = instanceCursor.getInt(0)
|
||||
|
||||
val eventCursor = context.contentResolver.query(CalendarContract.Events.CONTENT_URI, arrayOf(CalendarContract.Events.TITLE, CalendarContract.Events.ALL_DAY, CalendarContract.Events.CALENDAR_ID),
|
||||
CalendarContract.Events._ID + " is ?",
|
||||
arrayOf(Integer.toString(ID)), null)
|
||||
|
||||
if (eventCursor != null && eventCursor.count > 0) {
|
||||
eventCursor.moveToFirst()
|
||||
|
||||
for (j in 0 until eventCursor.count) {
|
||||
val e = Event(eventCursor, instanceCursor)
|
||||
val allDay: Boolean = !eventCursor.getString(1).equals("0")
|
||||
if ((SP.getBoolean(Constants.PREF_CALENDAR_ALL_DAY, false) || !allDay) && !(SP.getString(Constants.PREF_CALENDAR_FILTER, "").contains(" " + e.calendarID + ","))) {
|
||||
eventList.add(e)
|
||||
}
|
||||
eventCursor.moveToNext()
|
||||
}
|
||||
}
|
||||
|
||||
eventCursor.close()
|
||||
|
||||
instanceCursor.moveToNext()
|
||||
}
|
||||
val now = Calendar.getInstance()
|
||||
val limit = Calendar.getInstance()
|
||||
when (SP.getInt(Constants.PREF_SHOW_UNTIL, 1)) {
|
||||
0 -> limit.add(Calendar.HOUR, 3)
|
||||
1 -> limit.add(Calendar.HOUR, 6)
|
||||
2 -> limit.add(Calendar.HOUR, 12)
|
||||
3 -> limit.add(Calendar.DAY_OF_MONTH, 1)
|
||||
4 -> limit.add(Calendar.DAY_OF_MONTH, 3)
|
||||
5 -> limit.add(Calendar.DAY_OF_MONTH, 7)
|
||||
else -> limit.add(Calendar.HOUR, 6)
|
||||
}
|
||||
|
||||
instanceCursor.close()
|
||||
|
||||
if (eventList.isEmpty()) {
|
||||
val builder = CalendarContract.Instances.CONTENT_URI.buildUpon()
|
||||
ContentUris.appendId(builder, now.timeInMillis)
|
||||
ContentUris.appendId(builder, limit.timeInMillis)
|
||||
|
||||
if (!Util.checkGrantedPermission(context, Manifest.permission.READ_CALENDAR)) {
|
||||
resetNextEventData(context)
|
||||
} else {
|
||||
Collections.sort(eventList, { event: Event, event1: Event ->
|
||||
if (event.startDate > event1.startDate) {
|
||||
return@sort 1
|
||||
} else if (event.startDate < event1.startDate) {
|
||||
return@sort -1
|
||||
|
||||
val instanceCursor = context.contentResolver.query(builder.build(), arrayOf(CalendarContract.Instances.EVENT_ID, CalendarContract.Instances.BEGIN, CalendarContract.Instances.END), null, null, null)
|
||||
if (instanceCursor != null && instanceCursor.count > 0) {
|
||||
instanceCursor.moveToFirst()
|
||||
|
||||
for (i in 0 until instanceCursor.count) {
|
||||
val ID = instanceCursor.getInt(0)
|
||||
|
||||
val eventCursor = context.contentResolver.query(CalendarContract.Events.CONTENT_URI, arrayOf(CalendarContract.Events.TITLE, CalendarContract.Events.ALL_DAY, CalendarContract.Events.CALENDAR_ID),
|
||||
CalendarContract.Events._ID + " is ?",
|
||||
arrayOf(Integer.toString(ID)), null)
|
||||
|
||||
if (eventCursor != null && eventCursor.count > 0) {
|
||||
eventCursor.moveToFirst()
|
||||
|
||||
for (j in 0 until eventCursor.count) {
|
||||
val e = Event(eventCursor, instanceCursor)
|
||||
val allDay: Boolean = !eventCursor.getString(1).equals("0")
|
||||
if ((SP.getBoolean(Constants.PREF_CALENDAR_ALL_DAY, false) || !allDay) && !(SP.getString(Constants.PREF_CALENDAR_FILTER, "").contains(" " + e.calendarID + ","))) {
|
||||
eventList.add(e)
|
||||
}
|
||||
eventCursor.moveToNext()
|
||||
}
|
||||
}
|
||||
|
||||
eventCursor.close()
|
||||
|
||||
instanceCursor.moveToNext()
|
||||
}
|
||||
return@sort 0
|
||||
})
|
||||
saveNextEventData(context, eventList.get(0))
|
||||
}
|
||||
|
||||
instanceCursor.close()
|
||||
|
||||
if (eventList.isEmpty()) {
|
||||
resetNextEventData(context)
|
||||
} else {
|
||||
Collections.sort(eventList, { event: Event, event1: Event ->
|
||||
if (event.startDate > event1.startDate) {
|
||||
return@sort 1
|
||||
} else if (event.startDate < event1.startDate) {
|
||||
return@sort -1
|
||||
}
|
||||
return@sort 0
|
||||
})
|
||||
saveNextEventData(context, eventList.get(0))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resetNextEventData(context)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import android.util.TypedValue
|
||||
import android.content.Intent
|
||||
import android.content.ComponentName
|
||||
import android.preference.PreferenceManager
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
@ -76,10 +77,10 @@ object Util {
|
||||
|
||||
fun openURI(context: Context, url: String) {
|
||||
try {
|
||||
val builder: CustomTabsIntent.Builder = CustomTabsIntent.Builder();
|
||||
builder.setToolbarColor(ContextCompat.getColor(context, R.color.colorPrimary));
|
||||
val customTabsIntent: CustomTabsIntent = builder.build();
|
||||
customTabsIntent.launchUrl(context, Uri.parse(url));
|
||||
val builder: CustomTabsIntent.Builder = CustomTabsIntent.Builder()
|
||||
builder.setToolbarColor(ContextCompat.getColor(context, R.color.colorPrimary))
|
||||
val customTabsIntent: CustomTabsIntent = builder.build()
|
||||
customTabsIntent.launchUrl(context, Uri.parse(url))
|
||||
} catch (e: Exception) {
|
||||
try {
|
||||
val openIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
@ -91,10 +92,11 @@ object Util {
|
||||
Toast.makeText(context, R.string.error_opening_uri, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
val clipboard:ClipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText(context.getString(R.string.app_name), url);
|
||||
clipboard.primaryClip = clip;
|
||||
Toast.makeText(context, R.string.error_opening_uri, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
fun rateApp(context: Context, url: String) {
|
||||
val openIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
context.startActivity(openIntent)
|
||||
}
|
||||
|
||||
fun share(context: Context) {
|
||||
@ -229,4 +231,55 @@ object Util {
|
||||
}
|
||||
}
|
||||
|
||||
fun getCapWordString(text: String): String {
|
||||
return try {
|
||||
val ar = text.split(" ")
|
||||
var newText = ""
|
||||
for (t: String in ar) {
|
||||
newText += " "
|
||||
newText += t.substring(0, 1).toUpperCase()
|
||||
newText += t.substring(1)
|
||||
}
|
||||
newText.substring(1)
|
||||
} catch (e: Exception) {
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun showLocationNotification(context: Context, show: Boolean) {
|
||||
val mNotificationManager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager;
|
||||
|
||||
if (show) {
|
||||
val mBuilder: NotificationCompat.Builder = NotificationCompat.Builder(context, "Settings")
|
||||
.setSmallIcon(R.drawable.ic_stat_name)
|
||||
.setPriority(Notification.PRIORITY_MIN)
|
||||
.setColor(ContextCompat.getColor(context, R.color.colorPrimary))
|
||||
.setContentTitle(context.getString(R.string.notification_gps_title))
|
||||
.setContentText(context.getString(R.string.notification_gps_subtitle))
|
||||
.setAutoCancel(true);
|
||||
|
||||
val intent: Intent = Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
val pi: PendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
mBuilder.setContentIntent(pi);
|
||||
mNotificationManager.notify(1, mBuilder.build());
|
||||
} else {
|
||||
mNotificationManager.cancel(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun sendEmail(context: Context) {
|
||||
val i:Intent = Intent(Intent.ACTION_SEND)
|
||||
i.type = "message/rfc822"
|
||||
i.putExtra(Intent.EXTRA_EMAIL, arrayOf("tommaso.berlose@gmail.com"))
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.feedback_title))
|
||||
try {
|
||||
context.startActivity(Intent.createChooser(i, context.getString(R.string.feedback_chooser_title)))
|
||||
} catch (ex: Exception) {
|
||||
Toast.makeText(context, R.string.feedback_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,13 @@ import com.survivingwithandroid.weather.lib.provider.openweathermap.Openweatherm
|
||||
import com.survivingwithandroid.weather.lib.request.WeatherRequest
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
import android.content.DialogInterface
|
||||
import android.support.v4.content.ContextCompat.startActivity
|
||||
import android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS
|
||||
import android.content.Intent
|
||||
import android.location.LocationManager
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -22,41 +29,73 @@ import com.tommasoberlose.anotherwidget.`object`.Constants
|
||||
*/
|
||||
|
||||
object WeatherUtil {
|
||||
val API_KEY_1 = "43e744ad8ff91b09ea62dbc7d0e7c1dd"
|
||||
val API_KEY_2 = "61cde158f4bcc2e5cd18de7b9d000702"
|
||||
|
||||
fun updateWeather(context: Context) {
|
||||
Util.showLocationNotification(context, false)
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (SP.getString(Constants.PREF_CUSTOM_LOCATION_ADD, "").equals("") || SP.getString(Constants.PREF_CUSTOM_LOCATION_LAT, "").equals("") || SP.getString(Constants.PREF_CUSTOM_LOCATION_LON, "").equals("")) {
|
||||
|
||||
if (!Util.checkGrantedPermission(context, Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||
return
|
||||
}
|
||||
|
||||
var gpsEnabled = false
|
||||
var networkEnabled = false
|
||||
val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER))
|
||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER))
|
||||
try {
|
||||
gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, object : LocationListener {
|
||||
override fun onLocationChanged(location: Location) {
|
||||
locationManager.removeUpdates(this)
|
||||
getCurrentWeather(context, location)
|
||||
}
|
||||
try {
|
||||
networkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderDisabled(p0: String?) {
|
||||
}
|
||||
if (!gpsEnabled && !networkEnabled) {
|
||||
Util.showLocationNotification(context, true)
|
||||
} else {
|
||||
if (gpsEnabled) {
|
||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER))
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0f, object : LocationListener {
|
||||
override fun onLocationChanged(location: Location) {
|
||||
locationManager.removeUpdates(this)
|
||||
getCurrentWeather(context, location)
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderEnabled(p0: String?) {
|
||||
}
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderDisabled(p0: String?) {
|
||||
}
|
||||
|
||||
override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderEnabled(p0: String?) {
|
||||
}
|
||||
|
||||
override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getCurrentWeather(context, locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER))
|
||||
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0f, object : LocationListener {
|
||||
override fun onLocationChanged(location: Location) {
|
||||
locationManager.removeUpdates(this)
|
||||
getCurrentWeather(context, location)
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderDisabled(p0: String?) {
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onProviderEnabled(p0: String?) {
|
||||
}
|
||||
|
||||
override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
weatherNetworkRequest(context, SP.getString(Constants.PREF_CUSTOM_LOCATION_LAT, "").toDouble(), SP.getString(Constants.PREF_CUSTOM_LOCATION_LON, "").toDouble())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,42 +108,45 @@ object WeatherUtil {
|
||||
|
||||
fun weatherNetworkRequest(context: Context, latitude: Double, longitude: Double) {
|
||||
val SP: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (!SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "").equals("")) {
|
||||
try {
|
||||
val config = WeatherConfig()
|
||||
config.unitSystem = if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("C")) WeatherConfig.UNIT_SYSTEM.M else WeatherConfig.UNIT_SYSTEM.I
|
||||
config.lang = "en"
|
||||
config.maxResult = 1
|
||||
config.numDays = 1
|
||||
config.ApiKey = SP.getString(Constants.PREF_WEATHER_PROVIDER_API_KEY, "")
|
||||
|
||||
try {
|
||||
val config = WeatherConfig()
|
||||
config.unitSystem = if (SP.getString(Constants.PREF_WEATHER_TEMP_UNIT, "F").equals("C")) WeatherConfig.UNIT_SYSTEM.M else WeatherConfig.UNIT_SYSTEM.I
|
||||
config.lang = "en" // If you want to use english
|
||||
config.maxResult = 1 // Max number of cities retrieved
|
||||
config.numDays = 1 // Max num of days in the forecast
|
||||
config.ApiKey = API_KEY_2
|
||||
val client = WeatherClient.ClientBuilder().attach(context)
|
||||
.httpClient(com.survivingwithandroid.weather.lib.client.volley.WeatherClientDefault::class.java)
|
||||
.provider(OpenweathermapProviderType())
|
||||
.config(config)
|
||||
.build()
|
||||
|
||||
val client = WeatherClient.ClientBuilder().attach(context)
|
||||
.httpClient(com.survivingwithandroid.weather.lib.client.volley.WeatherClientDefault::class.java)
|
||||
.provider(OpenweathermapProviderType())
|
||||
.config(config)
|
||||
.build()
|
||||
client.getCurrentCondition(WeatherRequest(longitude, latitude), object : WeatherClient.WeatherEventListener {
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onWeatherRetrieved(currentWeather: CurrentWeather) {
|
||||
SP.edit()
|
||||
.putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp)
|
||||
.putString(Constants.PREF_WEATHER_ICON, currentWeather.weather.currentCondition.icon)
|
||||
.commit()
|
||||
Util.updateWidget(context)
|
||||
}
|
||||
|
||||
client.getCurrentCondition(WeatherRequest(longitude, latitude), object : WeatherClient.WeatherEventListener {
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onWeatherRetrieved(currentWeather: CurrentWeather) {
|
||||
SP.edit()
|
||||
.putFloat(Constants.PREF_WEATHER_TEMP, currentWeather.weather.temperature.temp)
|
||||
.putString(Constants.PREF_WEATHER_ICON, currentWeather.weather.currentCondition.icon)
|
||||
.commit()
|
||||
Util.updateWidget(context)
|
||||
}
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onWeatherError(e: WeatherLibException?) {
|
||||
// removeWeather(context, SP)
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onWeatherError(e: WeatherLibException?) {
|
||||
removeWeather(context, SP)
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onConnectionError(throwable: Throwable?) {
|
||||
removeWeather(context, SP)
|
||||
}
|
||||
})
|
||||
} catch (t: Exception) {
|
||||
@SuppressLint("ApplySharedPref")
|
||||
override fun onConnectionError(throwable: Throwable?) {
|
||||
// removeWeather(context, SP)
|
||||
}
|
||||
})
|
||||
} catch (t: Exception) {
|
||||
// removeWeather(context, SP)
|
||||
}
|
||||
} else {
|
||||
removeWeather(context, SP)
|
||||
}
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_action_alert.png
Normal file
After Width: | Height: | Size: 896 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_menu.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_paste.png
Normal file
After Width: | Height: | Size: 412 B |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 815 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 291 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_alert.png
Normal file
After Width: | Height: | Size: 538 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_menu.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_paste.png
Normal file
After Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 533 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_alert.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_action_menu.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_paste.png
Normal file
After Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 832 B After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 289 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_alert.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_menu.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_paste.png
Normal file
After Width: | Height: | Size: 801 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_save.png
Normal file
After Width: | Height: | Size: 462 B |
@ -1,113 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="108.0"
|
||||
android:viewportWidth="108.0">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#66FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
|
||||
|
34
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
@ -66,7 +66,6 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/custom_location_gps"
|
||||
android:id="@+id/action_default"
|
||||
android:src="@drawable/ic_action_reset"
|
||||
@ -76,7 +75,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black_10"/>
|
||||
<ListView
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/list_view" />
|
||||
|
@ -64,7 +64,6 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:contentDescription="@string/custom_location_gps"
|
||||
android:id="@+id/action_geolocation"
|
||||
android:src="@drawable/ic_action_gps"
|
||||
|
@ -1,73 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.tommasoberlose.anotherwidget.ui.activity.MainActivity"
|
||||
android:background="@drawable/gradient_background"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="32dp"
|
||||
android:id="@+id/toolbar"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/gradient_background"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/main_pre_title"
|
||||
android:alpha="0.6"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Subtitle"
|
||||
android:textAllCaps="true"/>
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="32dp"
|
||||
android:id="@+id/toolbar"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/main_pre_title"
|
||||
android:alpha="0.6"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Subtitle"
|
||||
android:textAllCaps="true"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Title"
|
||||
android:textAllCaps="true"/>
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="128dp"
|
||||
android:id="@+id/widget">
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:id="@+id/widget_bg"/>
|
||||
<include
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/the_widget"/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Title"
|
||||
android:textAllCaps="true"/>
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="128dp"
|
||||
android:id="@+id/widget">
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:id="@+id/widget_bg"/>
|
||||
<include
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
layout="@layout/the_widget"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3">
|
||||
android:layout_height="60dp"
|
||||
android:text="@string/add_widget"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:background="@color/black_30"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:id="@+id/action_add_widget"
|
||||
style="@style/AnotherWidget.Main.Button"/>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/all_set_container"
|
||||
tools:ignore="UselessParent">
|
||||
android:id="@+id/all_set_container">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/settings_calendar_title"
|
||||
android:visibility="gone"
|
||||
style="@style/AnotherWidget.Settings.Header"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -255,7 +261,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_weather_title"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
style="@style/AnotherWidget.Settings.Header"/>
|
||||
@ -289,6 +294,42 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/weather_settings"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/action_weather_provider_api_key"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:text="@string/settings_weather_provider_api_key_title"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/label_weather_provider_api_key"
|
||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:id="@+id/alert_icon"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_action_alert"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -388,101 +429,14 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:baselineAligned="false"
|
||||
android:id="@+id/menu_container"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/midnight_blue"
|
||||
android:layout_gravity="bottom">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/add_widget"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:id="@+id/action_add_widget"
|
||||
style="@style/AnotherWidget.Main.Button"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:id="@+id/action_refresh"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_action_refresh"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_refresh_widget"
|
||||
style="@style/AnotherWidget.Main.Button.TabBar"
|
||||
android:background="@android:color/transparent"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:id="@+id/action_share"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_action_sms"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_share"
|
||||
style="@style/AnotherWidget.Main.Button.TabBar"
|
||||
android:background="@android:color/transparent"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:id="@+id/action_support"
|
||||
android:orientation="vertical">
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:src="@drawable/ic_action_gift"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_support"
|
||||
style="@style/AnotherWidget.Main.Button.TabBar"
|
||||
android:background="@android:color/transparent"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="4dp"
|
||||
android:id="@+id/action_menu"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/ic_action_menu"/>
|
||||
</RelativeLayout>
|
85
app/src/main/res/layout/activity_weather_provider.xml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/gradient_background"
|
||||
tools:context="com.tommasoberlose.anotherwidget.ui.activity.WeatherProviderActivity">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_margin="32dp"
|
||||
android:id="@+id/toolbar"
|
||||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/main_pre_title"
|
||||
android:alpha="0.6"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Subtitle"
|
||||
android:textAllCaps="true"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:gravity="center_vertical"
|
||||
style="@style/AnotherWidget.Main.Title"
|
||||
android:textAllCaps="true"/>
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
app:cardCornerRadius="3dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@android:color/white"
|
||||
app:cardBackgroundColor="@android:color/white">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/white"
|
||||
android:padding="16dp"
|
||||
android:inputType="textCapWords"
|
||||
android:id="@+id/api_key"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/api_key_hint"/>
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:id="@+id/action_paste"
|
||||
android:src="@drawable/ic_action_paste"
|
||||
android:tint="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:text="@string/action_save"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:background="@color/colorAccent"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:id="@+id/action_save"
|
||||
style="@style/AnotherWidget.Main.Button"/>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
24
app/src/main/res/layout/application_info_layout.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:src="@mipmap/ic_generic_app"
|
||||
android:id="@+id/icon"/>
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="2"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@android:color/primary_text_light"
|
||||
style="@style/AnotherWidget.Settings.Title"/>
|
||||
</LinearLayout>
|
144
app/src/main/res/layout/main_menu_layout.xml
Normal file
@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
|
||||
android:id="@+id/fragment_history_menu_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="@android:color/white"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/action_refresh"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:tint="@android:color/primary_text_light"
|
||||
android:src="@drawable/ic_action_refresh"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_refresh_widget"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:background="@android:color/transparent"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@android:color/primary_text_light" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:textSize="14sp"
|
||||
android:id="@+id/action_rate"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:tint="@android:color/primary_text_light"
|
||||
android:src="@drawable/ic_action_rate"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_rate"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/action_feedback"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:tint="@android:color/primary_text_light"
|
||||
android:src="@drawable/ic_action_sms"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_feedback"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/action_share"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:tint="@android:color/primary_text_light"
|
||||
android:src="@drawable/ic_action_share"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_share"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@android:color/primary_text_light"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/action_support"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:tint="@color/midnight_blue"
|
||||
android:src="@drawable/ic_action_gift"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_support"
|
||||
style="@style/AnotherWidget.Settings.Title"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="@color/colorNightDark"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_generic_app.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_generic_app.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_generic_app.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_generic_app.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_generic_app.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_generic_app.png
Normal file
After Width: | Height: | Size: 14 KiB |
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Another Widget</string>
|
||||
<string name="add_widget">Aggiungi Another Widget</string>
|
||||
<string name="add_widget">Aggiungi Widget</string>
|
||||
<string name="main_pre_title">Just</string>
|
||||
<string name="button_request_permission">Concedi Accesso</string>
|
||||
<string name="all_set_btn">Rimani Aggiornato</string>
|
||||
@ -48,7 +48,7 @@
|
||||
<string name="settings_weather_refresh_period_subtitle_5">24 Ore</string>
|
||||
<string name="settings_custom_location_title">Località Meteo</string>
|
||||
<string name="custom_location_gps">Geolocalizzazione</string>
|
||||
<string name="action_refresh_widget">Aggiorna</string>
|
||||
<string name="action_refresh_widget">Aggiorna Widget</string>
|
||||
<string name="show_events_visible">Eventi Visibili</string>
|
||||
<string name="show_events_not_visible">Eventi non Visibili</string>
|
||||
<string name="show_weather_visible">Meteo Visibile</string>
|
||||
@ -68,4 +68,16 @@
|
||||
<string name="settings_weather_app_title">Il meteo apre</string>
|
||||
<string name="default_name">App Predefinita</string>
|
||||
<string name="action_choose_application">Scegli Applicazione</string>
|
||||
<string name="settings_weather_provider_api_key_title">"Provider del Meteo "</string>
|
||||
<string name="settings_weather_provider_api_key_subtitle_all_set">Il provider meteo è configurato correttamente</string>
|
||||
<string name="settings_weather_provider_api_key_subtitle_not_set">Il provider meteo deve essere configurato</string>
|
||||
<string name="notification_gps_title">Localizzazione disattivata</string>
|
||||
<string name="notification_gps_subtitle">Riaccendi la localizzazione per avere il meteo aggiornato.</string>
|
||||
<string name="action_feedback">Feedback</string>
|
||||
<string name="feedback_title">AW Feedback</string>
|
||||
<string name="feedback_chooser_title">Invia email...</string>
|
||||
<string name="feedback_error">Errore invio mail.</string>
|
||||
<string name="api_key_hint">Chiave API OpenWeather</string>
|
||||
<string name="error_weather_api_key">Il provider non è configurato correttamente, vuoi comunque uscire?</string>
|
||||
<string name="action_save">Salva</string>
|
||||
</resources>
|
@ -3,7 +3,7 @@
|
||||
<color name="colorPrimary">#0092ca</color>
|
||||
<color name="colorPrimaryDark">#0083B5</color>
|
||||
<color name="colorNightDark">#124E96</color>
|
||||
<color name="colorAccent">#124E96</color>
|
||||
<color name="colorAccent">#04507D</color>
|
||||
<color name="colorPrimaryLight">#DAEAF6</color>
|
||||
<color name="black_50">#80000000</color>
|
||||
<color name="black_30">#48000000</color>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<resources>
|
||||
<string name="app_name">Another Widget</string>
|
||||
<string name="add_widget">Add Another Widget</string>
|
||||
<string name="add_widget">Add Widget</string>
|
||||
<string name="main_pre_title">Just</string>
|
||||
<string name="button_request_permission">Grant Permission</string>
|
||||
<string name="title_permission_calendar">See your Events</string>
|
||||
@ -49,7 +49,7 @@
|
||||
<string name="settings_weather_refresh_period_subtitle_5">24 Hours</string>
|
||||
<string name="settings_custom_location_title">Custom Location</string>
|
||||
<string name="custom_location_gps">Geolocation</string>
|
||||
<string name="action_refresh_widget">Refresh</string>
|
||||
<string name="action_refresh_widget">Refresh Widget</string>
|
||||
<string name="show_events_visible">Events are Visible</string>
|
||||
<string name="show_events_not_visible">Events are not Visible</string>
|
||||
<string name="show_weather_visible">Weather Info are Visible</string>
|
||||
@ -70,4 +70,16 @@
|
||||
<string name="settings_weather_app_title">Tap on weather opens</string>
|
||||
<string name="default_name">Default App</string>
|
||||
<string name="action_choose_application">Choose Application</string>
|
||||
<string name="settings_weather_provider_api_key_title">Weather Provider</string>
|
||||
<string name="settings_weather_provider_api_key_subtitle_all_set">The weather provider is configured correctly</string>
|
||||
<string name="settings_weather_provider_api_key_subtitle_not_set">The weather provider must be configured</string>
|
||||
<string name="notification_gps_title">Location is turned off</string>
|
||||
<string name="notification_gps_subtitle">Turn on the localization to get the updated weather.</string>
|
||||
<string name="action_feedback">Feedback</string>
|
||||
<string name="feedback_title">AW Feedback</string>
|
||||
<string name="feedback_chooser_title">Send email...</string>
|
||||
<string name="feedback_error">Error sending email.</string>
|
||||
<string name="api_key_hint">OpenWeather API Key</string>
|
||||
<string name="error_weather_api_key">The provider is not configured correctly, do you still want to go back?</string>
|
||||
<string name="action_save">Save</string>
|
||||
</resources>
|
||||
|