Added audio-video notes activity
This commit is contained in:
parent
b6070c6b0a
commit
ae4e3f3837
5 changed files with 91 additions and 15 deletions
|
@ -128,6 +128,7 @@
|
|||
<activity android:name="net.osmand.plus.monitoring.SettingsMonitoringActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.rastermaps.SettingsRasterMapsActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.routepointsnavigation.RoutePointsActivity" />
|
||||
<activity android:name=".dashboard.DashAudioVideoNotesActivity" />
|
||||
|
||||
<activity android:name="net.osmand.plus.osmedit.SettingsOsmEditingActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
<activity android:name="net.osmand.plus.development.SettingsDevelopmentActivity" android:configChanges="keyboardHidden|orientation" />
|
||||
|
|
15
OsmAnd/res/layout/audio_video_notes_all.xml
Normal file
15
OsmAnd/res/layout/audio_video_notes_all.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:id="@+id/main_scroll"
|
||||
android:background="@color/dashboard_background" >
|
||||
|
||||
<fragment
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="net.osmand.plus.dashboard.DashAudioVideoNotesFragment"
|
||||
android:layout_marginTop="@dimen/dashCardMargin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</ScrollView>
|
|
@ -6,7 +6,8 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
<LinearLayout android:id="@+id/header"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight">
|
||||
<TextView android:id="@+id/notes_text"
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MainMenuActivity;
|
||||
|
||||
/**
|
||||
* Created by Denis on 23.12.2014.
|
||||
*/
|
||||
public class DashAudioVideoNotesActivity extends SherlockFragmentActivity {
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setContentView(R.layout.audio_video_notes_all);
|
||||
|
||||
ColorDrawable color = new ColorDrawable(getResources().getColor(R.color.actionbar_color));
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setTitle(R.string.audionotes_plugin_name);
|
||||
actionBar.setBackgroundDrawable(color);
|
||||
actionBar.setIcon(android.R.color.transparent);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
this.finish();
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -11,6 +13,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
|
@ -24,23 +27,31 @@ import java.util.List;
|
|||
*/
|
||||
public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
||||
AudioVideoNotesPlugin plugin;
|
||||
boolean allNotes;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
allNotes = getActivity() instanceof DashAudioVideoNotesActivity;
|
||||
if (allNotes) {
|
||||
view.findViewById(R.id.header).setVisibility(View.GONE);
|
||||
} else {
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.notes_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
}
|
||||
});
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
final Intent favorites = new Intent(activity, DashAudioVideoNotesActivity.class);
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -80,7 +91,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
|
||||
LinearLayout notesLayout = (LinearLayout) mainView.findViewById(R.id.notes);
|
||||
notesLayout.removeAllViews();
|
||||
if (notes.size() > 3){
|
||||
if (notes.size() > 3 && !allNotes){
|
||||
while (notes.size() != 3){
|
||||
notes.remove(3);
|
||||
}
|
||||
|
@ -95,6 +106,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
((TextView) view.findViewById(R.id.descr)).setText(recording.getDescription(getActivity()));
|
||||
} else {
|
||||
((TextView) view.findViewById(R.id.name)).setText(recording.getDescription(getActivity()));
|
||||
view.findViewById(R.id.descr).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||
|
@ -105,12 +117,21 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
} else {
|
||||
icon.setImageResource(R.drawable.ic_type_img);
|
||||
}
|
||||
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
View.OnClickListener playListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
public void onClick(View v) {
|
||||
plugin.playRecording(getActivity(), recording);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (allNotes){
|
||||
view.findViewById(R.id.play).setVisibility(View.GONE);
|
||||
view.setOnClickListener(playListener);
|
||||
} else {
|
||||
view.findViewById(R.id.play).setOnClickListener(playListener);
|
||||
}
|
||||
|
||||
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics());
|
||||
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
|
||||
|
|
Loading…
Reference in a new issue